panhui 5 жил өмнө
parent
commit
3795b5ac0f

+ 1 - 0
src/main/vue/src/views/Admin.vue

@@ -217,6 +217,7 @@ export default {
             if (command === 'logout') {
             if (command === 'logout') {
                 localStorage.removeItem('token');
                 localStorage.removeItem('token');
                 this.$store.commit('updateUserInfo', null);
                 this.$store.commit('updateUserInfo', null);
+                this.$store.commit('updateOrganization', null);
                 this.$router.replace('/login');
                 this.$router.replace('/login');
             } else if (command === 'pwd') {
             } else if (command === 'pwd') {
                 this.onShowPwdDialog();
                 this.onShowPwdDialog();

+ 5 - 12
src/main/vue/src/views/Login.vue

@@ -280,21 +280,14 @@ export default {
                         })
                         })
                         .then(res => {
                         .then(res => {
                             localStorage.setItem('token', res);
                             localStorage.setItem('token', res);
-                            return this.$http.get('/user/my');
+                            return this.$store.dispatch('getUserInfo');
                         })
                         })
                         .then(res => {
                         .then(res => {
-                            this.loading = false;
-                            this.$store.commit('updateUserInfo', res);
-                            let flag = res.authorities.find(item => {
-                                return item.name == 'ROLE_ORGANIZER';
-                            });
-                            if (typeof flag != 'undefined') {
-                                this.$http.get('/organization/getByUserId/' + res.id).then(index => {
-                                    this.$store.commit('updateOrganization', index);
+                            this.$nextTick(() => {
+                                this.loading = false;
+                                this.$router.replace({
+                                    name: this.$route.params.name || 'dashboard'
                                 });
                                 });
-                            }
-                            this.$router.replace({
-                                name: this.$route.params.name || 'dashboard'
                             });
                             });
                         })
                         })
                         .catch(e => {
                         .catch(e => {