Skip to content

Commit e449beb

Browse files
fmalcherd-koppenhagen
authored andcommitted
fix: use onError/onSuccess for validateAsync
1 parent 03ca4c0 commit e449beb

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/app/registration-form-2/registration-form-2.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,15 @@ export const formSchema = schema<RegisterFormData>((fieldPath) => {
4545
});
4646
},
4747
// Maps resource to error
48-
errors: (result) => {
48+
onSuccess: (result) => {
4949
return result
5050
? customError({
5151
kind: 'userExists',
5252
message: 'The username you entered was already taken',
5353
})
5454
: undefined;
5555
},
56+
onError: () => undefined
5657
});
5758

5859
// Age validation

src/app/registration-form-3/registration-form-3.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,15 @@ export const formSchema = schema<RegisterFormData>((fieldPath) => {
4949
});
5050
},
5151
// Maps resource to error
52-
errors: (result) => {
52+
onSuccess: (result) => {
5353
return result
5454
? customError({
5555
kind: 'userExists',
5656
message: 'The username you entered was already taken',
5757
})
5858
: undefined;
5959
},
60+
onError: () => undefined
6061
});
6162

6263
// Age validation

0 commit comments

Comments
 (0)