perf: 修改请求错误提示,改为生产环境统一显示系统忙

pull/56/head
moonrailgun 3 years ago
parent 0b053bf081
commit 09b11b17e6

@ -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<T extends FunctionReturningPromise>(
try {
await fn(...args);
} catch (err) {
showErrorToasts(err);
showErrorToasts(isDevelopment ? err : t('系统忙, 请稍后再试'));
console.error(err);
}
}, deps);

@ -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",

@ -34,6 +34,7 @@
"k2488f9ee": "申请好友",
"k249e23b9": "邮箱格式不正确",
"k24ccd723": "立即刷新",
"k250e392c": "系统忙, 请稍后再试",
"k267cc491": "我",
"k2a8031e": "个人主页",
"k2c6ee8d": "确认操作",

Loading…
Cancel
Save