退出时清空表格记忆缓存
This commit is contained in:
@@ -9,6 +9,9 @@ import useUserStore from '@/store/modules/user';
|
|||||||
import useAlarmStore from '@/store/modules/alarm';
|
import useAlarmStore from '@/store/modules/alarm';
|
||||||
import useLockedStore from '@/store/modules/locked';
|
import useLockedStore from '@/store/modules/locked';
|
||||||
import { hasPermissions } from '@/plugins/auth-user';
|
import { hasPermissions } from '@/plugins/auth-user';
|
||||||
|
import { dbClear } from '@/utils/cache-db-utils';
|
||||||
|
import { CACHE_DB_TABLE_DND } from '@/constants/cache-keys-constants';
|
||||||
|
|
||||||
const { isFullscreen, toggle } = useFullscreen();
|
const { isFullscreen, toggle } = useFullscreen();
|
||||||
const { t, changeLocale, optionsLocale } = useI18n();
|
const { t, changeLocale, optionsLocale } = useI18n();
|
||||||
const lockedStore = useLockedStore();
|
const lockedStore = useLockedStore();
|
||||||
@@ -26,7 +29,10 @@ function fnClick({ key }: MenuInfo) {
|
|||||||
router.push({ name: 'Profile' });
|
router.push({ name: 'Profile' });
|
||||||
break;
|
break;
|
||||||
case 'logout':
|
case 'logout':
|
||||||
userStore.fnLogOut().finally(() => router.push({ name: 'Login' }));
|
userStore.fnLogOut().finally(() => {
|
||||||
|
dbClear(CACHE_DB_TABLE_DND);
|
||||||
|
router.push({ name: 'Login' });
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,24 @@ export async function dbGet(storeName: string, key: string) {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**数据级缓存全部移除 */
|
||||||
|
export async function dbClear(storeName: string) {
|
||||||
|
if (!storeName ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
localforage.config({
|
||||||
|
name: import.meta.env.VITE_APP_CODE,
|
||||||
|
storeName: storeName,
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
await localforage.clear();
|
||||||
|
return true;
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**数据级缓存移除 */
|
/**数据级缓存移除 */
|
||||||
export async function dbRemove(storeName: string, key: string) {
|
export async function dbRemove(storeName: string, key: string) {
|
||||||
if (!storeName || !key) {
|
if (!storeName || !key) {
|
||||||
|
|||||||
Reference in New Issue
Block a user