mirror of
https://github.com/dataease/dataease.git
synced 2026-05-15 05:22:13 +08:00
perf: 前端缓存清除机制
This commit is contained in:
committed by
fit2cloud-chenyw
parent
0a2a3d2a9b
commit
1dd0b10cbc
@@ -16,6 +16,8 @@ import { config } from './config'
|
||||
import { configHandler } from './refresh'
|
||||
import { isMobile, getLocale } from '@/utils/utils'
|
||||
import { useRequestStoreWithOut } from '@/store/modules/request'
|
||||
import { clearCache } from '@/utils/cacheUtil'
|
||||
|
||||
type AxiosErrorWidthLoading<T> = T & {
|
||||
config: {
|
||||
loading?: boolean
|
||||
@@ -189,7 +191,7 @@ service.interceptors.response.use(
|
||||
showClose: true
|
||||
})
|
||||
if (response.data.code === 80001) {
|
||||
localStorage.clear()
|
||||
clearCache()
|
||||
let queryRedirectPath = '/workbranch/index'
|
||||
if (router.currentRoute.value.fullPath) {
|
||||
queryRedirectPath = router.currentRoute.value.fullPath as string
|
||||
@@ -246,7 +248,7 @@ service.interceptors.response.use(
|
||||
|
||||
error.config.loading && tryHideLoading(permissionStore.getCurrentPath)
|
||||
if (header.has('DE-GATEWAY-FLAG')) {
|
||||
localStorage.clear()
|
||||
clearCache()
|
||||
const flag = header.get('DE-GATEWAY-FLAG')
|
||||
localStorage.setItem('DE-GATEWAY-FLAG', flag.toString())
|
||||
let queryRedirectPath = '/workbranch/index'
|
||||
@@ -295,7 +297,6 @@ const executeVersionHandler = (response: AxiosResponse) => {
|
||||
return
|
||||
}
|
||||
if (executeVersion && executeVersion !== cacheVal) {
|
||||
wsCache.clear()
|
||||
wsCache.set(key, executeVersion)
|
||||
showMsg('系统有升级,请点击刷新页面', '-sys-upgrade-')
|
||||
}
|
||||
|
||||
21
core/core-frontend/src/utils/cacheUtil.ts
Normal file
21
core/core-frontend/src/utils/cacheUtil.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
export const clearCache = () => {
|
||||
const keys = [
|
||||
'DataEaseKey',
|
||||
'TreeSort-backend',
|
||||
'app.desktop',
|
||||
'de-global-refresh',
|
||||
'open-backend',
|
||||
'panel-weight',
|
||||
'screen-weight',
|
||||
'user.exp',
|
||||
'user.language',
|
||||
'user.name',
|
||||
'user.oid',
|
||||
'user.time',
|
||||
'user.token',
|
||||
'user.uid'
|
||||
]
|
||||
keys.forEach(key => {
|
||||
localStorage.removeItem(key)
|
||||
})
|
||||
}
|
||||
2
de-xpack
2
de-xpack
Submodule de-xpack updated: 2cbba8ae77...edf9ca0ee6
Reference in New Issue
Block a user