fix: fix token storage after login
Save keystone_token after login, earlier than profile api Change-Id: Ia65a2c386f3f04ebf61b030c28d9efab17d6558d
This commit is contained in:
parent
c0727c95d8
commit
3091c21e6e
@ -103,9 +103,15 @@ export class RootStore {
|
|||||||
this.routing.push(`${pathname}?${getQueryString(newParams)}`);
|
this.routing.push(`${pathname}?${getQueryString(newParams)}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
setKeystoneToken(result) {
|
||||||
|
const { keystone_token } = result || {};
|
||||||
|
setLocalStorageItem('keystone_token', keystone_token);
|
||||||
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
async login(params) {
|
async login(params) {
|
||||||
await this.client.login(params);
|
const result = await this.client.login(params);
|
||||||
|
this.setKeystoneToken(result);
|
||||||
return this.getUserProfileAndPolicy();
|
return this.getUserProfileAndPolicy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +139,6 @@ export class RootStore {
|
|||||||
this.user = user;
|
this.user = user;
|
||||||
this.policies = policies;
|
this.policies = policies;
|
||||||
const {
|
const {
|
||||||
keystone_token,
|
|
||||||
endpoints = {},
|
endpoints = {},
|
||||||
license = {},
|
license = {},
|
||||||
version = '',
|
version = '',
|
||||||
@ -144,7 +149,7 @@ export class RootStore {
|
|||||||
this.license = license || {};
|
this.license = license || {};
|
||||||
this.version = version;
|
this.version = version;
|
||||||
this.updateUserRoles(user);
|
this.updateUserRoles(user);
|
||||||
setLocalStorageItem('keystone_token', keystone_token);
|
this.setKeystoneToken(user);
|
||||||
this.endpoints = endpoints;
|
this.endpoints = endpoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +184,7 @@ export class RootStore {
|
|||||||
this.client.policies.list(),
|
this.client.policies.list(),
|
||||||
]);
|
]);
|
||||||
this.updateUser(profile, policies.policies || []);
|
this.updateUser(profile, policies.policies || []);
|
||||||
this.getNeutronExtensions();
|
return this.getNeutronExtensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
@ -229,8 +234,7 @@ export class RootStore {
|
|||||||
this.user = null;
|
this.user = null;
|
||||||
const result = await this.client.switchProject(projectId, domainId);
|
const result = await this.client.switchProject(projectId, domainId);
|
||||||
this.clearData();
|
this.clearData();
|
||||||
const { keystone_token } = result;
|
this.setKeystoneToken(result);
|
||||||
setLocalStorageItem('keystone_token', keystone_token);
|
|
||||||
return this.getUserProfileAndPolicy();
|
return this.getUserProfileAndPolicy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user