From fa7a6e85f4f7df3adac8cfe884f0592dd6c11aca Mon Sep 17 00:00:00 2001 From: SwiftHawk Date: Mon, 8 Jul 2024 14:27:09 +0500 Subject: [PATCH] fix: fetch app data from after login --- src/layouts/Main.tsx | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/layouts/Main.tsx b/src/layouts/Main.tsx index 274c849..60b052b 100644 --- a/src/layouts/Main.tsx +++ b/src/layouts/Main.tsx @@ -94,15 +94,6 @@ export const MainLayout = () => { metadataController.findMetadata(usersPubkey).then((metadataEvent) => { if (metadataEvent) handleMetadataEvent(metadataEvent) }) - - setLoadingSpinnerDesc(`Fetching user's app data`) - getUsersAppData() - .then((appData) => { - if (appData) { - dispatch(updateUserAppData(appData)) - } - }) - .finally(() => setIsLoading(false)) } else { setIsLoading(false) } @@ -118,11 +109,6 @@ export const MainLayout = () => { const pubkey = authState.usersPubkey || authState.keyPair?.public if (pubkey) { - /** - * Sigit notifications are wrapped using nip 59 seal and gift wrap scheme. - * According to nip59 created_at for seal and gift wrap should be tweaked to thwart time-analysis attacks. - * For the above purpose created_at is set to random time upto 2 days in past - */ subscribeForSigits(pubkey).then((res) => { subCloser = res || null }) @@ -148,6 +134,16 @@ export const MainLayout = () => { if (pubkey) { dispatch(setUserRobotImage(getRoboHashPicture(pubkey))) } + + setIsLoading(true) + setLoadingSpinnerDesc(`Fetching user's app data`) + getUsersAppData() + .then((appData) => { + if (appData) { + dispatch(updateUserAppData(appData)) + } + }) + .finally(() => setIsLoading(false)) } }, [authState])