fix(plugin-fm): fix page crash when 413 in local dev (#4560)

This commit is contained in:
Junyi 2024-06-05 13:46:34 +08:00 committed by GitHub
parent 2dfa7a2625
commit 8cc5ad2abf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -115,8 +115,13 @@ export const getThumbURL = (target: any) => {
export function getResponseMessage({ error, response }: UploadFile<any>) { export function getResponseMessage({ error, response }: UploadFile<any>) {
if (error instanceof Error && 'isAxiosError' in error) { if (error instanceof Error && 'isAxiosError' in error) {
// @ts-ignore
if (error.response) {
// @ts-ignore // @ts-ignore
return error.response.data?.errors?.map?.((item) => item?.message).join(', '); return error.response.data?.errors?.map?.((item) => item?.message).join(', ');
} else {
return error.message;
}
} }
if (!response) { if (!response) {
return ''; return '';