Hey is a decentralized and permissionless social media app built with Lens Protocol 馃尶
at main 19 lines 600 B view raw
1import { Localstorage } from "@hey/data/storage"; 2import type { AccountFragment } from "@hey/indexer"; 3import { createPersistedTrackedStore } from "@/store/createTrackedStore"; 4 5interface State { 6 currentAccount?: AccountFragment; 7 setCurrentAccount: (currentAccount?: AccountFragment) => void; 8} 9 10const { useStore: useAccountStore } = createPersistedTrackedStore<State>( 11 (set, _get) => ({ 12 currentAccount: undefined, 13 setCurrentAccount: (currentAccount?: AccountFragment) => 14 set(() => ({ currentAccount })) 15 }), 16 { name: Localstorage.AccountStore } 17); 18 19export { useAccountStore };