1👍
You need to set the user authentication status globally. Vuex
can be used for this purpose.
Example code
const state = {
isAuth: false
}
const mutations ={
setAuth:(state,value)=>state.isAuth = value
}
const actions = {
loginRequest:function({commit}){
// perform login request
commit('setAuth',true); // call this after you get the login response
}
}
Inside the component add a computed function
computed:{
isAuth:function(){
return this.$store.state.isAuth;
}
}
Now isAuth
can use for handling the condition to hide the sections you need.
- [Vuejs]-Vuetify make two v-flex section have same height side-by-side
- [Vuejs]-Display API data from rapidapi in vue
Source:stackexchange.com