Fix/webapp loop login (#21092)
This commit is contained in:
@@ -19,7 +19,7 @@ const Layout: FC<{
|
|||||||
const [isLoading, setIsLoading] = useState(true)
|
const [isLoading, setIsLoading] = useState(true)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
(async () => {
|
(async () => {
|
||||||
if (!systemFeatures.webapp_auth.enabled) {
|
if (!isGlobalPending && !systemFeatures.webapp_auth.enabled) {
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -37,7 +37,7 @@ const Layout: FC<{
|
|||||||
setWebAppAccessMode(ret?.accessMode || AccessMode.PUBLIC)
|
setWebAppAccessMode(ret?.accessMode || AccessMode.PUBLIC)
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
})()
|
})()
|
||||||
}, [pathname, redirectUrl, setWebAppAccessMode])
|
}, [pathname, redirectUrl, setWebAppAccessMode, isGlobalPending, systemFeatures.webapp_auth.enabled])
|
||||||
if (isLoading || isGlobalPending) {
|
if (isLoading || isGlobalPending) {
|
||||||
return <div className='flex h-full w-full items-center justify-center'>
|
return <div className='flex h-full w-full items-center justify-center'>
|
||||||
<Loading />
|
<Loading />
|
||||||
|
@@ -408,7 +408,7 @@ export const ssePost = async (
|
|||||||
|
|
||||||
if (data.code === 'web_sso_auth_required') {
|
if (data.code === 'web_sso_auth_required') {
|
||||||
removeAccessToken()
|
removeAccessToken()
|
||||||
requiredWebSSOLogin()
|
requiredWebSSOLogin(data.message, 401)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.code === 'unauthorized') {
|
if (data.code === 'unauthorized') {
|
||||||
@@ -492,7 +492,7 @@ export const request = async<T>(url: string, options = {}, otherOptions?: IOther
|
|||||||
}
|
}
|
||||||
if (code === 'web_sso_auth_required') {
|
if (code === 'web_sso_auth_required') {
|
||||||
removeAccessToken()
|
removeAccessToken()
|
||||||
requiredWebSSOLogin()
|
requiredWebSSOLogin(message, 401)
|
||||||
return Promise.reject(err)
|
return Promise.reject(err)
|
||||||
}
|
}
|
||||||
if (code === 'unauthorized_and_force_logout') {
|
if (code === 'unauthorized_and_force_logout') {
|
||||||
|
Reference in New Issue
Block a user