Bläddra i källkod

Fix/webapp loop login (#21092)

tags/1.5.0
NFish 4 månader sedan
förälder
incheckning
d7663159e9
Inget konto är kopplat till bidragsgivarens mejladress
2 ändrade filer med 4 tillägg och 4 borttagningar
  1. 2
    2
      web/app/(shareLayout)/layout.tsx
  2. 2
    2
      web/service/base.ts

+ 2
- 2
web/app/(shareLayout)/layout.tsx Visa fil

@@ -19,7 +19,7 @@ const Layout: FC<{
const [isLoading, setIsLoading] = useState(true)
useEffect(() => {
(async () => {
if (!systemFeatures.webapp_auth.enabled) {
if (!isGlobalPending && !systemFeatures.webapp_auth.enabled) {
setIsLoading(false)
return
}
@@ -37,7 +37,7 @@ const Layout: FC<{
setWebAppAccessMode(ret?.accessMode || AccessMode.PUBLIC)
setIsLoading(false)
})()
}, [pathname, redirectUrl, setWebAppAccessMode])
}, [pathname, redirectUrl, setWebAppAccessMode, isGlobalPending, systemFeatures.webapp_auth.enabled])
if (isLoading || isGlobalPending) {
return <div className='flex h-full w-full items-center justify-center'>
<Loading />

+ 2
- 2
web/service/base.ts Visa fil

@@ -408,7 +408,7 @@ export const ssePost = async (

if (data.code === 'web_sso_auth_required') {
removeAccessToken()
requiredWebSSOLogin()
requiredWebSSOLogin(data.message, 401)
}

if (data.code === 'unauthorized') {
@@ -492,7 +492,7 @@ export const request = async<T>(url: string, options = {}, otherOptions?: IOther
}
if (code === 'web_sso_auth_required') {
removeAccessToken()
requiredWebSSOLogin()
requiredWebSSOLogin(message, 401)
return Promise.reject(err)
}
if (code === 'unauthorized_and_force_logout') {

Laddar…
Avbryt
Spara