mirror of
https://github.com/zclzone/vue-naive-admin.git
synced 2025-12-28 12:10:20 +08:00
refactor: simplify wrapper storage
This commit is contained in:
12
src/utils/cache/index.js
vendored
12
src/utils/cache/index.js
vendored
@@ -1,15 +1,21 @@
|
||||
import { createWebStorage } from './web-storage'
|
||||
import { createStorage } from './storage'
|
||||
|
||||
const prefixKey = 'Vue_Naive_Admin_'
|
||||
|
||||
export const createLocalStorage = function (option = {}) {
|
||||
return createWebStorage({
|
||||
return createStorage({
|
||||
prefixKey: option.prefixKey || '',
|
||||
storage: localStorage,
|
||||
})
|
||||
}
|
||||
|
||||
export const createSessionStorage = function (option = {}) {
|
||||
return createWebStorage({
|
||||
return createStorage({
|
||||
prefixKey: option.prefixKey || '',
|
||||
storage: sessionStorage,
|
||||
})
|
||||
}
|
||||
|
||||
export const lStorage = createLocalStorage({ prefixKey })
|
||||
|
||||
export const sStorage = createSessionStorage({ prefixKey })
|
||||
|
||||
Reference in New Issue
Block a user