From 09b11b17e610d89e777e5b3ded320e7065346482 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Wed, 28 Sep 2022 20:58:51 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BF=AE=E6=94=B9=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA=EF=BC=8C=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E7=8E=AF=E5=A2=83=E7=BB=9F=E4=B8=80=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=B3=BB=E7=BB=9F=E5=BF=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/shared/hooks/useAsyncRequest.ts | 4 +++- client/shared/i18n/langs/en-US/translation.json | 1 + client/shared/i18n/langs/zh-CN/translation.json | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/client/shared/hooks/useAsyncRequest.ts b/client/shared/hooks/useAsyncRequest.ts index 00f06639..cd427a21 100644 --- a/client/shared/hooks/useAsyncRequest.ts +++ b/client/shared/hooks/useAsyncRequest.ts @@ -1,4 +1,5 @@ import type { DependencyList } from 'react'; +import { isDevelopment, t } from '..'; import { showErrorToasts } from '../manager/ui'; import type { FunctionReturningPromise } from '../types'; import { useAsyncFn } from './useAsyncFn'; @@ -11,7 +12,8 @@ export function useAsyncRequest( try { await fn(...args); } catch (err) { - showErrorToasts(err); + showErrorToasts(isDevelopment ? err : t('系统忙, 请稍后再试')); + console.error(err); } }, deps); diff --git a/client/shared/i18n/langs/en-US/translation.json b/client/shared/i18n/langs/en-US/translation.json index 704d86f8..f3c4f96a 100644 --- a/client/shared/i18n/langs/en-US/translation.json +++ b/client/shared/i18n/langs/en-US/translation.json @@ -34,6 +34,7 @@ "k2488f9ee": "Friend Request", "k249e23b9": "E-mail format is incorrect", "k24ccd723": "Refresh now", + "k250e392c": "System is busy, please try again later", "k267cc491": "Me", "k2a8031e": "Homepage", "k2c6ee8d": "Confirm the action", diff --git a/client/shared/i18n/langs/zh-CN/translation.json b/client/shared/i18n/langs/zh-CN/translation.json index d6c587bb..1fbfdd6b 100644 --- a/client/shared/i18n/langs/zh-CN/translation.json +++ b/client/shared/i18n/langs/zh-CN/translation.json @@ -34,6 +34,7 @@ "k2488f9ee": "申请好友", "k249e23b9": "邮箱格式不正确", "k24ccd723": "立即刷新", + "k250e392c": "系统忙, 请稍后再试", "k267cc491": "我", "k2a8031e": "个人主页", "k2c6ee8d": "确认操作",