add message array

This commit is contained in:
Amirhossein Mahmoodi
2024-05-20 10:23:59 +03:30
parent a586e7504a
commit bedfb830c1

View File

@@ -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) {