cache issue fix

This commit is contained in:
Yuri Kuznetsov
2021-06-17 13:10:07 +03:00
parent e4778dea36
commit 44d97b64b9
2 changed files with 22 additions and 2 deletions

View File

@@ -592,11 +592,23 @@ define(
this.auth = this.storage.get('user', 'auth') || null;
this.baseController.on('login', data => {
this.auth = Base64.encode(data.auth.userName + ':' + data.auth.token);
let userId = data.user.id;
let userName = data.auth.userName;
let token = data.auth.token;
this.auth = Base64.encode(userName + ':' + token);
let lastUserId = this.storage.get('user', 'lastUserId');
if (lastUserId !== userId) {
this.metadata.clearCache();
this.language.clearCache();
}
this.storage.set('user', 'auth', this.auth);
this.storage.set('user', 'lastUserId', userId);
this.setCookieAuth(data.auth.userName, data.auth.token);
this.setCookieAuth(userName, token);
this.initUserData(data, () => this.trigger('auth'));
});

View File

@@ -137,6 +137,14 @@ define('metadata', [], function () {
}
},
clearCache: function () {
if (!this.cache) {
return;
}
this.cache.clear('app', 'metadata');
},
getScopeList: function () {
let scopes = this.get('scopes') || {};
let scopeList = [];