mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-22 08:47:06 +08:00
🚧 WIP: add local path picbed for manage page
This commit is contained in:
@@ -1,11 +1,18 @@
|
||||
class LS {
|
||||
get (name: string) {
|
||||
const item = localStorage.getItem(name) as string
|
||||
return item ? JSON.parse(item) : {}
|
||||
const item = localStorage.getItem(name)
|
||||
if (item) {
|
||||
try {
|
||||
return JSON.parse(item)
|
||||
} catch (e) {
|
||||
console.error('Failed to parse JSON:', e)
|
||||
}
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
set (name: string, value: any) {
|
||||
return localStorage.setItem(name, JSON.stringify(value))
|
||||
set (name: string, value: any): void {
|
||||
localStorage.setItem(name, JSON.stringify(value))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user