mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 23:27:12 +01:00
Replaced redux with zustand. Fixed login issue, closes #980.
This commit is contained in:
parent
7071f5fba5
commit
9937caa569
33 changed files with 234 additions and 286 deletions
10
lib/web.js
10
lib/web.js
|
|
@ -65,9 +65,17 @@ export const setItem = (key, data, session) => {
|
|||
}
|
||||
};
|
||||
|
||||
function tryParse(value) {
|
||||
try {
|
||||
return JSON.parse(value);
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
export const getItem = (key, session) =>
|
||||
typeof window !== 'undefined'
|
||||
? JSON.parse((session ? sessionStorage : localStorage).getItem(key))
|
||||
? tryParse((session ? sessionStorage : localStorage).getItem(key))
|
||||
: null;
|
||||
|
||||
export const removeItem = (key, session) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue