From 5a51bdd824db1a7a451de0b67d9566cb5cf809b3 Mon Sep 17 00:00:00 2001 From: balibabu Date: Sat, 8 Feb 2025 11:26:36 +0800 Subject: [PATCH] Fix: The requested interface timeout will cause the page to crash #4787 (#4788) ### What problem does this PR solve? Fix: The requested interface timeout will cause the page to crash #4787 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- web/src/utils/request.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/utils/request.ts b/web/src/utils/request.ts index fe1577289..d7c067390 100644 --- a/web/src/utils/request.ts +++ b/web/src/utils/request.ts @@ -68,7 +68,7 @@ const errorHandler = (error: { }); } } - return response; + return response ?? { data: { code: 1999 } }; }; const request: RequestMethod = extend({ @@ -98,7 +98,7 @@ request.interceptors.request.use((url: string, options: any) => { }; }); -request.interceptors.response.use(async (response: any, options) => { +request.interceptors.response.use(async (response: Response, options) => { if (response?.status === 413 || response?.status === 504) { message.error(RetcodeMessage[response?.status as ResultCode]); }