You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the vuex auth plugin for authentication. I have a profiled field in user. If the user has a complete profile, can access all features, else push the user to Profile page. The profiled field validation is in the router. When the profile is updated, it does not update the authenticated user in the store state.auth.user.
Router.beforeEach((to, from, next) => {
if (to.meta.requiresAuth) {
if (store.getters.isAuthenticated) {
const user = store.getters.user;
if (store.getters.isProfiled) {
// redirects to list
next();
} else {
if (to.name == "profile") {
next();
} else {
next(false);
return Router.push('profile');
}
}
next();
} else {
next(false);
return Router.push('login')
}
} else {
next()
}
})
I have the following Vuex store (store/index.js):
import Vue from 'vue'
import Vuex from 'vuex'
import client, { BaseModel, makeServicePlugin, makeAuthPlugin, FeathersVuex } from 'src/api/client'
Vue.use(Vuex)
Vue.use(FeathersVuex)
const store = new Vuex.Store({
state: {
...
},
getters: {
isAuthenticated: state => !!state.auth.accessToken,
isProfiled: state => !!state.auth.user.profiled,
user: state => state.auth.user,
},
mutations: {
...
},
actions: {},
plugins: [
...
...
makeAuthPlugin({ userService: 'user' })
]
})
export default store
Expected behavior
The profiled in auth/user should change each time when the user profile got updated.
Actual behavior
auth/user is not updated reactively.
System configuration
Tell us about the applicable parts of your setup.
Module versions (especially the part that's not working):
Hi,
I am using the vuex auth plugin for authentication. I have a
profiled
field in user. If the user has a complete profile, can access all features, else push the user to Profile page. Theprofiled
field validation is in the router. When the profile is updated, it does not update the authenticated user in the store state.auth.user.I have the following Vuex store (store/index.js):
Expected behavior
The
profiled
inauth/user
should change each time when the user profile got updated.Actual behavior
auth/user
is not updated reactively.System configuration
Tell us about the applicable parts of your setup.
Module versions (especially the part that's not working):
NodeJS version:
v12.22.7
Operating System:
Ubuntu 18.04
Browser Version:
Chrome 97
The text was updated successfully, but these errors were encountered: