-
-
Notifications
You must be signed in to change notification settings - Fork 106
Open
Description
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. 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):
"@feathersjs/authentication-client": "^4.5.7",
"@feathersjs/feathers": "^4.5.7",
"@feathersjs/socketio-client": "^4.5.7",
"@quasar/extras": "^1.9.3",
"feathers-vuex": "^3.11.5",
"quasar": "^1.12.13",
"socket.io-client": "^2.3.0",
NodeJS version:
v12.22.7
Operating System:
Ubuntu 18.04
Browser Version:
Chrome 97
Metadata
Metadata
Assignees
Labels
No labels