Merge pull request #76 from Discours/session-hotfix

session context hotfix
This commit is contained in:
Igor Lobanov 2022-12-07 12:07:07 +01:00 committed by GitHub
commit e58285019b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -26,6 +26,7 @@
"server": "node server/server.mjs",
"start": "astro dev",
"start:local": "cross-env PUBLIC_API_URL=http://127.0.0.1:8080 astro dev",
"start:production": "cross-env PUBLIC_API_URL=https://v2.discours.io astro dev",
"start:staging": "cross-env PUBLIC_API_URL=https://testapi.discours.io astro dev",
"typecheck": "astro check && tsc --noEmit",
"typecheck:watch": "tsc --noEmit --watch",

View File

@ -33,12 +33,13 @@ export const SessionProvider = (props: { children: JSX.Element }) => {
return null
}
setToken(authResult.token)
setIsSessionLoaded(true)
return authResult
} catch (error) {
console.error('getSession error:', error)
resetToken()
return null
} finally {
setIsSessionLoaded(true)
}
}