Handle validation error toasts

This commit is contained in:
Mel O'Hagan 2022-07-20 10:46:24 +01:00
parent 40ef719f2f
commit ec586191e7
1 changed files with 8 additions and 1 deletions

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)
}
}
}