requireAuth-fix-2

This commit is contained in:
Untone 2024-01-23 00:03:57 +03:00
parent 92eae0347b
commit 30e143e081

View File

@ -255,12 +255,20 @@ export const SessionProvider = (props: {
const requireAuthentication = async (callback: () => void, modalSource: AuthModalSource) => { const requireAuthentication = async (callback: () => void, modalSource: AuthModalSource) => {
setIsAuthWithCallback(() => callback) setIsAuthWithCallback(() => callback)
if (!session()) {
await loadSession() await loadSession()
if (!session()) { if (!session()) {
showModal('auth', modalSource) showModal('auth', modalSource)
} }
} }
}
createEffect(() => {
if (isAuthWithCallback()) {
isAuthWithCallback()()
setIsAuthWithCallback(null)
}
})
// authorizer api proxy methods // authorizer api proxy methods
const signUp = async (params: SignupInput) => { const signUp = async (params: SignupInput) => {