From bedfb830c108fb22555bb86805a796c788d09922 Mon Sep 17 00:00:00 2001 From: Amirhossein Mahmoodi Date: Mon, 20 May 2024 10:23:59 +0330 Subject: [PATCH] add message array --- src/core/utils/errorHandler.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/core/utils/errorHandler.js b/src/core/utils/errorHandler.js index e380e84..10ff105 100644 --- a/src/core/utils/errorHandler.js +++ b/src/core/utils/errorHandler.js @@ -51,7 +51,20 @@ const isServerError = status => status >= 500 && status <= 599; const isClientError = status => status >= 400 && status <= 499; const errorLogic = (pushToastList, response, t, notification) => { - if (notification) Notifications(pushToastList, "error", t, response.status, response.data.message); + if (notification) { + if (Array.isArray(response.data.message)) { + response.data.message.map((item) => { + Notifications(pushToastList, "error", t, response.status, item); + }); + } else + Notifications( + pushToastList, + "error", + t, + response.status, + response.data.message + ); + } } const errorValidation = (pushToastList, response, t, notification) => { if (notification) {