mirror of
https://github.com/PrimalHQ/primal-web-app.git
synced 2024-09-29 00:10:50 +00:00
Fetch nostr key when not in root
This commit is contained in:
parent
5b9e4ca2ea
commit
0e586d6631
@ -78,6 +78,14 @@ const Layout: Component = () => {
|
||||
}
|
||||
}
|
||||
|
||||
createEffect(() => {
|
||||
if (location.pathname === '/' || account?.isKeyLookupDone) return;
|
||||
|
||||
setTimeout(() => {
|
||||
account?.actions.checkNostrKey();
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
return (
|
||||
<Show
|
||||
when={location.pathname !== '/'}
|
||||
|
@ -90,6 +90,7 @@ export type AccountContextStore = {
|
||||
logout: () => void,
|
||||
showGetStarted: () => void,
|
||||
saveEmoji: (emoji: EmojiOption) => void,
|
||||
checkNostrKey: () => void,
|
||||
},
|
||||
}
|
||||
|
||||
@ -1105,14 +1106,12 @@ export function AccountProvider(props: { children: JSXElement }) {
|
||||
saveEmojiHistory(store.publicKey, store.emojiHistory);
|
||||
};
|
||||
|
||||
// EFFECTS --------------------------------------
|
||||
const checkNostrKey = () => {
|
||||
updateStore('isKeyLookupDone', false);
|
||||
fetchNostrKey();
|
||||
};
|
||||
|
||||
onMount(() => {
|
||||
setTimeout(() => {
|
||||
updateStore('isKeyLookupDone', false);
|
||||
fetchNostrKey();
|
||||
}, 1000);
|
||||
});
|
||||
// EFFECTS --------------------------------------
|
||||
|
||||
createEffect(() => {
|
||||
const pubkey = store.publicKey;
|
||||
@ -1325,6 +1324,7 @@ const [store, updateStore] = createStore<AccountContextStore>({
|
||||
logout,
|
||||
showGetStarted,
|
||||
saveEmoji,
|
||||
checkNostrKey,
|
||||
},
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user