From f40979b4aded593e3920038b01cae77d4d839801 Mon Sep 17 00:00:00 2001 From: wood chen Date: Fri, 21 Feb 2025 21:00:20 +0800 Subject: [PATCH] fix: Decode callback URL and reset loading state on authentication error --- src/components/auth/user-auth-form.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/auth/user-auth-form.tsx b/src/components/auth/user-auth-form.tsx index 8e70a90..3df35c1 100644 --- a/src/components/auth/user-auth-form.tsx +++ b/src/components/auth/user-auth-form.tsx @@ -26,7 +26,8 @@ export function UserAuthForm({ const body: Record = {}; const callbackUrl = searchParams?.get("callbackUrl"); if (callbackUrl) { - body.return_url = callbackUrl; + const decodedUrl = decodeURIComponent(callbackUrl); + body.return_url = decodedUrl; } const response = await fetch("/api/auth/q58", { @@ -50,6 +51,7 @@ export function UserAuthForm({ description: "登录过程中发生错误,请稍后重试", variant: "destructive", }); + setIsLoading(false); } }