mirror of
https://github.com/luxfhe/example-redact.git
synced 2026-10-30 18:13:20 +00:00
14 lines
432 B
TypeScript
14 lines
432 B
TypeScript
import superjson from "superjson";
|
|
|
|
export const superjsonStorage = {
|
|
getItem: (name: string) => {
|
|
const str = localStorage.getItem(name);
|
|
if (!str) return null;
|
|
return superjson.parse(str) as unknown as ReturnType<typeof JSON.parse>;
|
|
},
|
|
setItem: (name: string, value: unknown) => {
|
|
localStorage.setItem(name, superjson.stringify(value));
|
|
},
|
|
removeItem: (name: string) => localStorage.removeItem(name),
|
|
};
|