From ebca5c371643d54cb6d6c1c222430301abcbb233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Poussard?= <tpoussard@neogeo.fr> Date: Fri, 7 Jul 2023 14:36:58 +0200 Subject: [PATCH] reload user permissions after sso login --- src/store/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/store/index.js b/src/store/index.js index 01775282..54c408e2 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -203,17 +203,27 @@ export default new Vuex.Store({ } }, - async CONNECT_SSO_WITH_TOKEN({ commit }, token) { + async CONNECT_SSO_WITH_TOKEN({ commit, dispatch }, token) { axios .get(`${this.state.configuration.VUE_APP_DJANGO_API_BASE}login-token/?token=${token}`) .then((response) => { if (response && (response.status === 200 || response.status === 201)) { const user = response.data; commit('SET_USER', user); + dispatch('GET_USER_LEVEL_PROJECTS'); + dispatch('GET_USER_LEVEL_PERMISSIONS'); + commit('DISPLAY_MESSAGE', { + comment: `Vous êtes maintenant connecté ${ user.first_name} ${ user.last_name}`, level: 'positive' + }); } }) .catch((err) => { console.error(err); + console.log(err.toString()); + console.log(err.message); + commit('DISPLAY_MESSAGE', { + comment: 'La connexion a échoué.', level: 'negative' + }); }); }, -- GitLab