From 570a1ffa650cea650a0d53cebd84049081a6d3ae Mon Sep 17 00:00:00 2001 From: Eamon-meng <17516219072@163.com> Date: Thu, 26 Jun 2025 10:08:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=B7=E6=96=B0=E4=BB=A4?= =?UTF-8?q?=E7=89=8CmaxAge=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/actions/auth.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/actions/auth.ts b/src/actions/auth.ts index f8c0db6..080fd48 100644 --- a/src/actions/auth.ts +++ b/src/actions/auth.ts @@ -23,6 +23,7 @@ export async function login(props: { grant_type: 'password', login_type: 'phone_code', }) + if (!result.success) { return result } @@ -38,6 +39,7 @@ export async function login(props: { cookieStore.set('auth_refresh', data.refresh_token, { httpOnly: true, sameSite: 'strict', + maxAge: Number.MAX_SAFE_INTEGER, }) return { @@ -97,7 +99,9 @@ export async function refreshAuth() { // 处理请求 if (!resp.success) { - cookie.delete('auth_refresh') + if (resp.status === 401) { + cookie.delete('auth_refresh') + } throw UnauthorizedError }