feat(阶段1): 搬入 ojnext 为 apps/web,未改业务代码
This commit is contained in:
21
apps/web/src/utils/storage.ts
Normal file
21
apps/web/src/utils/storage.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
const localStorage = window.localStorage
|
||||
|
||||
export default {
|
||||
set(key: string, value: any) {
|
||||
localStorage.setItem(key, JSON.stringify(value))
|
||||
},
|
||||
get(key: string) {
|
||||
const content = localStorage.getItem(key)
|
||||
if (content) {
|
||||
return JSON.parse(content)
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
},
|
||||
remove(key: string) {
|
||||
localStorage.removeItem(key)
|
||||
},
|
||||
clear() {
|
||||
localStorage.clear()
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user