diff --git a/src/store/index.js b/src/store/index.js index 0177528226f98e6699de3e39a94578432507cf77..54c408e2be0cd45a6fa2ac08beb0c1668aa14d35 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' + }); }); },