diff --git a/src/utils/http.tsx b/src/utils/http.tsx index af604fb4..785c6905 100644 --- a/src/utils/http.tsx +++ b/src/utils/http.tsx @@ -57,18 +57,19 @@ const errorHandler = function ( return error.config?.onError(error.response); } - notification.error({ - message: msg, - description: ( - <> - {error.response?.data?.errors?.map((item: any) => ( -
- {item.message} ({item.value}) -
- ))} - - ), - }); + msg && + notification.error({ + message: msg, + description: error.response?.data?.errors ? ( + <> + {error.response?.data?.errors?.map((item: any) => ( +
+ {item.message} ({item.value}) +
+ ))} + + ) : undefined, + }); } } else { console.log(error.message); @@ -117,13 +118,13 @@ _request.interceptors.response.use(async (response) => { msg && notification.error({ message: msg, - description: ( + description: res?.errors ? ( <> {res?.errors.map((item: any) => (
{item.message}
))} - ), + ) : undefined, }); } return res;