1
0
Fork 0
mirror of synced 2024-07-14 10:45:51 +12:00

Handle validation error toasts

This commit is contained in:
Mel O'Hagan 2022-07-20 10:46:24 +01:00
parent 5a3688d237
commit 6e63151143

View file

@ -58,7 +58,14 @@ export const API = createAPIClient({
}
}
if (!ignore) {
notificationStore.actions.error(message)
const validationErrors = error?.json?.validationErrors
if (validationErrors) {
for (let field in validationErrors) {
notificationStore.actions.error(`${field} ${validationErrors[field]}`)
}
} else {
notificationStore.actions.error(message)
}
}
}