[Vuejs]-Vuejs can't get vuex value in navbar

1👍

Put an upper condition in your navbar. Im not sure if will still works in yours. Like this

<template v-if="$store.getters.loggedUser">
    <li v-if="isLoggedIn && $store.getters.loggedUser.type == 'admin'" class="nav-item 
    dropdown">
      ...
    </li>
</template>

On the other hand. What I did on it is I separated another state for loggedUser type. It seems that not the good way but it will help you then.

if you will make a separate state for that then now you have to call it by this

 <li v-if="isLoggedIn && $store.getters.loggedUser_type == 'admin'" class="nav-item 
        dropdown">

Leave a comment