Skip to content
This repository was archived by the owner on Jan 21, 2021. It is now read-only.

Commit 1f66c56

Browse files
committed
support flattened errors
1 parent 9c77697 commit 1f66c56

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/InertiaForm.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,12 @@ class InertiaForm {
195195
return this.inertiaPage().errorBags[this.__options.bag][field][0];
196196
}
197197

198-
errors(field) {
198+
errors(field = null) {
199+
if (field === null) {
200+
return Object.values(this.inertiaPage().errorBags[this.__options.bag])
201+
.reduce((a, b) => a.concat(b), []);
202+
}
203+
199204
return this.error(field)
200205
? this.inertiaPage().errorBags[this.__options.bag][field]
201206
: [];

0 commit comments

Comments
 (0)