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