From dfaf39e37e4b3bc123409b21c4d139e859c92b68 Mon Sep 17 00:00:00 2001 From: luorijun Date: Wed, 17 Jun 2026 13:34:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B7=B3=E8=BD=AC=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E6=8B=A6=E6=88=AA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/actions/base.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/actions/base.ts b/src/actions/base.ts index 04d7336..eb7b0e2 100644 --- a/src/actions/base.ts +++ b/src/actions/base.ts @@ -1,6 +1,7 @@ 'use server' import {API_BASE_URL, ApiResponse, CLIENT_ID, CLIENT_SECRET} from '@/lib/api' import {add, isBefore} from 'date-fns' +import {isRedirectError} from 'next/dist/client/components/redirect-error' import {cookies, headers} from 'next/headers' import {redirect} from 'next/navigation' import {cache} from 'react' @@ -169,6 +170,9 @@ async function call(url: string, body: RequestInit['body'], auth? } catch (e) { console.error('后端请求失败', url, (e as Error).message) + if (isRedirectError(e)) { + throw e + } throw new Error(`请求失败,网络错误`) } }