Commit fedd9caefbffd8689c94ca5c6a3a6c7bd90de197
1 parent
5bf90eea
wip: cache miss
Showing
5 changed files
with
8 additions
and
5 deletions
src/main.ts
@@ -32,6 +32,9 @@ import { isDevMode } from '/@/utils/env'; | @@ -32,6 +32,9 @@ import { isDevMode } from '/@/utils/env'; | ||
32 | // Register global components | 32 | // Register global components |
33 | registerGlobComp(app); | 33 | registerGlobComp(app); |
34 | 34 | ||
35 | + // Multilingual configuration | ||
36 | + await setupI18n(app); | ||
37 | + | ||
35 | // Configure routing | 38 | // Configure routing |
36 | setupRouter(app); | 39 | setupRouter(app); |
37 | 40 | ||
@@ -45,7 +48,7 @@ import { isDevMode } from '/@/utils/env'; | @@ -45,7 +48,7 @@ import { isDevMode } from '/@/utils/env'; | ||
45 | setupErrorHandle(app); | 48 | setupErrorHandle(app); |
46 | 49 | ||
47 | // Mount when the route is ready | 50 | // Mount when the route is ready |
48 | - await Promise.all([setupI18n(app), router.isReady()]); | 51 | + await router.isReady(); |
49 | 52 | ||
50 | app.mount('#app', true); | 53 | app.mount('#app', true); |
51 | 54 |
src/settings/projectSetting.ts
@@ -23,7 +23,7 @@ const setting: ProjectConfig = { | @@ -23,7 +23,7 @@ const setting: ProjectConfig = { | ||
23 | permissionMode: PermissionModeEnum.ROLE, | 23 | permissionMode: PermissionModeEnum.ROLE, |
24 | 24 | ||
25 | // Permission-related cache is stored in sessionStorage or localStorage | 25 | // Permission-related cache is stored in sessionStorage or localStorage |
26 | - permissionCacheType: CacheTypeEnum.SESSION, | 26 | + permissionCacheType: CacheTypeEnum.LOCAL, |
27 | 27 | ||
28 | // color | 28 | // color |
29 | themeColor: primaryColor, | 29 | themeColor: primaryColor, |
src/utils/auth/index.ts
@@ -17,5 +17,5 @@ export function getAuthCache<T>(key: BasicKeys) { | @@ -17,5 +17,5 @@ export function getAuthCache<T>(key: BasicKeys) { | ||
17 | 17 | ||
18 | export function setAuthCache(key: BasicKeys, value) { | 18 | export function setAuthCache(key: BasicKeys, value) { |
19 | const fn = isLocal ? Persistent.setLocal : Persistent.setSession; | 19 | const fn = isLocal ? Persistent.setLocal : Persistent.setSession; |
20 | - return fn(key, value); | 20 | + return fn(key, value, true); |
21 | } | 21 | } |
src/utils/cache/memory.ts
@@ -59,7 +59,7 @@ export class Memory<T = any, V = any> { | @@ -59,7 +59,7 @@ export class Memory<T = any, V = any> { | ||
59 | } | 59 | } |
60 | item.time = new Date().getTime() + this.alive; | 60 | item.time = new Date().getTime() + this.alive; |
61 | item.timeoutId = setTimeout(() => { | 61 | item.timeoutId = setTimeout(() => { |
62 | - this.remove(key); | 62 | + // this.remove(key); |
63 | }, expires); | 63 | }, expires); |
64 | 64 | ||
65 | return value; | 65 | return value; |
src/utils/cache/persistent.ts
@@ -69,7 +69,7 @@ export class Persistent { | @@ -69,7 +69,7 @@ export class Persistent { | ||
69 | 69 | ||
70 | static setSession(key: SessionKeys, value: SessionStore[SessionKeys], immediate = false): void { | 70 | static setSession(key: SessionKeys, value: SessionStore[SessionKeys], immediate = false): void { |
71 | sessionMemory.set(key, toRaw(value)); | 71 | sessionMemory.set(key, toRaw(value)); |
72 | - immediate && ss.set(APP_SESSION_CACHE_KEY, sessionMemory); | 72 | + immediate && ss.set(APP_SESSION_CACHE_KEY, sessionMemory.getCache); |
73 | } | 73 | } |
74 | 74 | ||
75 | static removeSession(key: SessionKeys): void { | 75 | static removeSession(key: SessionKeys): void { |