store/enhancedImageBuilderApi: handle empty error data
Turns out it can also return `{error: data: {}}`, so without `errors`
inside the data object.
This commit is contained in:
parent
3addcf66f4
commit
3dcafd5672
1 changed files with 5 additions and 1 deletions
|
|
@ -5,7 +5,11 @@ import { imageBuilderApi } from './imageBuilderApi';
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
const errorMessage = (err: any) => {
|
||||
let msg = err.error.statusText;
|
||||
if (err.error.data?.errors.length > 0 && err.error.data?.errors[0]?.detail) {
|
||||
if (
|
||||
err.error.data?.errors &&
|
||||
err.error.data?.errors.length > 0 &&
|
||||
err.error.data?.errors[0]?.detail
|
||||
) {
|
||||
msg = err.error.data?.errors[0]?.detail;
|
||||
}
|
||||
return msg;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue