0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-20 21:32:31 -05:00

fix(console): show i18n content of "errors.unknown_server_error"

This commit is contained in:
Charles Zhao 2022-10-19 16:35:20 +08:00
parent 7fc0f43699
commit f355ecbbc9
No known key found for this signature in database
GPG key ID: 4858774754C92DF2

View file

@ -21,11 +21,13 @@ export class RequestError extends Error {
}
const toastError = async (response: Response) => {
const fallbackErrorMessage = t('admin_console.errors.unknown_server_error');
try {
const data = await response.json<RequestErrorBody>();
toast.error([data.message, data.details].join('\n') || t('errors.unknown_server_error'));
toast.error([data.message, data.details].join('\n') || fallbackErrorMessage);
} catch {
toast.error(t('errors.unknown_server_error'));
toast.error(fallbackErrorMessage);
}
};