Handle validation error toasts
This commit is contained in:
parent
40ef719f2f
commit
ec586191e7
|
@ -58,9 +58,16 @@ export const API = createAPIClient({
|
|||
}
|
||||
}
|
||||
if (!ignore) {
|
||||
const validationErrors = error?.json?.validationErrors
|
||||
if (validationErrors) {
|
||||
for (let field in validationErrors) {
|
||||
notificationStore.actions.error(`${field} ${validationErrors[field]}`)
|
||||
}
|
||||
} else {
|
||||
notificationStore.actions.error(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Log all errors to console
|
||||
console.warn(`[Client] HTTP ${status} on ${method}:${url}\n\t${message}`)
|
||||
|
|
Loading…
Reference in New Issue