sc
This commit is contained in:
@@ -99,6 +99,8 @@ export const useUserStore = defineStore('user', () => {
|
||||
|
||||
// 退出系统
|
||||
const logOutAction = () => {
|
||||
const instance_id = storage.get(constant.instanceId);
|
||||
const tenant_id = storage.get(constant.tenant_id);
|
||||
return new Promise((resolve, reject) => {
|
||||
logout(token.value)
|
||||
.then(() => {
|
||||
@@ -107,8 +109,15 @@ export const useUserStore = defineStore('user', () => {
|
||||
SET_CURRENT_ROLE('');
|
||||
SET_PERMISSIONS([]);
|
||||
removeToken();
|
||||
storage.clean();
|
||||
resolve();
|
||||
storage.clean().then(() => {
|
||||
if (!isEmpty(instance_id)) {
|
||||
storage.set(constant.instanceId, instance_id);
|
||||
}
|
||||
if (!isEmpty(tenant_id)) {
|
||||
storage.set(constant.tenant_id, tenant_id);
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
reject(error);
|
||||
|
||||
@@ -25,7 +25,17 @@ const storage = {
|
||||
uni.setStorageSync(storageKey, storageData);
|
||||
},
|
||||
clean: function () {
|
||||
uni.removeStorageSync(storageKey);
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.removeStorage({
|
||||
key: storageKey,
|
||||
success: () => {
|
||||
resolve();
|
||||
},
|
||||
fail: err => {
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user