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

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