In my Vue.js project, I've implemented a function that hides a specific menu item for users with insufficient permissions:
<a :href="href" @click="navigate" v-if="hideMenuItem()">
// some code
</a>
hideMenuItem() {
if(currentUser.permission == 'All') {
return true;
} else return false;
}
This successfully hides the element on the UI, preventing the user from accessing a certain page by clicking on an anchor link. However, there is a loophole where the user can still access the page by directly entering the URL in their browser. How can I prevent this?
Any help would be appreciated. Thank you!