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 }