mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2026-02-06 09:55:47 +00:00
fix: move invitingProfile null check immediately after fetch
Co-authored-by: antontranelis <31516529+antontranelis@users.noreply.github.com>
This commit is contained in:
parent
24adbd4bf6
commit
9bde446bdf
@ -98,6 +98,13 @@ export function InvitePage({ inviteApi, itemsApi }: Props) {
|
||||
|
||||
const invitingProfile = await itemsApi.getItem(invitingProfileId)
|
||||
|
||||
if (!invitingProfile) {
|
||||
toast.error('Inviting profile not found')
|
||||
localStorage.removeItem('inviteCode')
|
||||
void navigate('/')
|
||||
return
|
||||
}
|
||||
|
||||
if (invitingProfileId === myProfile?.id) {
|
||||
toast.error('You cannot invite yourself')
|
||||
localStorage.removeItem('inviteCode')
|
||||
@ -117,13 +124,6 @@ export function InvitePage({ inviteApi, itemsApi }: Props) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!invitingProfile) {
|
||||
toast.error('Inviting profile not found')
|
||||
localStorage.removeItem('inviteCode')
|
||||
void navigate('/')
|
||||
return
|
||||
}
|
||||
|
||||
setInvitingProfile(invitingProfile)
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user