From 30e143e0810525e2ee69c1101e0000df6042f12f Mon Sep 17 00:00:00 2001 From: Untone Date: Tue, 23 Jan 2024 00:03:57 +0300 Subject: [PATCH] requireAuth-fix-2 --- src/context/session.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/context/session.tsx b/src/context/session.tsx index 3d7b701b..94a69ea0 100644 --- a/src/context/session.tsx +++ b/src/context/session.tsx @@ -255,13 +255,21 @@ export const SessionProvider = (props: { const requireAuthentication = async (callback: () => void, modalSource: AuthModalSource) => { setIsAuthWithCallback(() => callback) - await loadSession() - if (!session()) { - showModal('auth', modalSource) + await loadSession() + if (!session()) { + showModal('auth', modalSource) + } } } + createEffect(() => { + if (isAuthWithCallback()) { + isAuthWithCallback()() + setIsAuthWithCallback(null) + } + }) + // authorizer api proxy methods const signUp = async (params: SignupInput) => { const authResult: void | AuthToken = await authorizer().signup(params)