Преглед на файлове

Set user in local storage

pull/5/head
Svitlana преди 4 години
родител
ревизия
3a51918d89
променени са 2 файла, в които са добавени 8 реда и са изтрити 7 реда
  1. +0
    -1
      src/_services/user.service.js
  2. +8
    -6
      src/auth/AppLoginPage.vue

+ 0
- 1
src/_services/user.service.js Целия файл

@@ -6,7 +6,6 @@ import config from 'config';
import { util } from '../_helpers';

export const userService = {
setSessionUser,
login,
logout,
forgotPassword,


+ 8
- 6
src/auth/AppLoginPage.vue Целия файл

@@ -27,13 +27,16 @@

if (!this.$route.query.hasOwnProperty('session') || typeof session === 'undefined' || session === null) {
console.warn('AppLoginPage.created: session parameter is empty, sending to login page');
this.$router.push('/login');
if (util.userLoggedIn()) {
this.logout({messages: this.messages, errors: this.errors});
}
this.$router.replace('/login');
return;
}

if (!this.$route.query.hasOwnProperty('uri') || (typeof uri !== 'undefined' && uri !== null && uri.length > 0 && uri[0] !== '/')) {
if (typeof uri !== 'undefined' && uri !== null && uri.length > 0 && uri[0] !== '/') {
console.warn('AppLoginPage.created: uri parameter is not empty, sending to login page');
this.$router.push('/login');
this.$router.replace('/login');
return;
}

@@ -45,15 +48,14 @@
if (uri.startsWith('/appLogin')) {
uri = '/';
}
this.user.token = session;
this.setSessionUser(this.user);
user.token = session;
localStorage.setItem(util.USER_KEY, JSON.stringify(user));
this.checkSession({messages: this.messages, errors: this.errors});
this.$router.push({path: uri});
return;
},
methods: {
...mapActions('account', ['login', 'logout', 'checkSession']),
...mapActions('users', ['setSessionUser']),
...mapActions('system', ['loadSystemConfigs', 'loadMessages']),
}
};

Зареждане…
Отказ
Запис