migrated activeAccount state to rehook

This commit is contained in:
Ren Amamiya
2023-04-11 09:02:39 +07:00
parent 0bfcb10253
commit 4e1dcdc2ce
20 changed files with 72 additions and 85 deletions

View File

@@ -1,14 +0,0 @@
import { atomWithStorage, createJSONStorage } from 'jotai/utils';
const createMyJsonStorage = () => {
const storage = createJSONStorage(() => localStorage);
const getItem = (key) => {
const value = storage.getItem(key);
return value;
};
return { ...storage, getItem };
};
export const activeAccountAtom = atomWithStorage('activeAccount', {}, createMyJsonStorage());
export const activeAccountFollowsAtom = atomWithStorage('activeAccountFollows', [], createMyJsonStorage());
export const lastLoginAtom = atomWithStorage('lastLogin', [], createMyJsonStorage());