From d7663159e97582fc8008a072bb22d8f25e2ab0e7 Mon Sep 17 00:00:00 2001 From: NFish Date: Tue, 17 Jun 2025 10:45:03 +0800 Subject: [PATCH] Fix/webapp loop login (#21092) --- web/app/(shareLayout)/layout.tsx | 4 ++-- web/service/base.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/web/app/(shareLayout)/layout.tsx b/web/app/(shareLayout)/layout.tsx index 7de5d51ed..78b883500 100644 --- a/web/app/(shareLayout)/layout.tsx +++ b/web/app/(shareLayout)/layout.tsx @@ -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
diff --git a/web/service/base.ts b/web/service/base.ts index ba398c07a..5242f15b8 100644 --- a/web/service/base.ts +++ b/web/service/base.ts @@ -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(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') {