fix: fetch app data from after login

This commit is contained in:
SwiftHawk 2024-07-08 14:27:09 +05:00
parent ef5376e2d1
commit fa7a6e85f4

View File

@ -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])