Skip to content

Commit

Permalink
updated docs for lifecycle hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Smef committed Jun 10, 2024
1 parent ab5fd06 commit 21a4fc9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const form = usePrecognitionForm("post", "/api/entries", {
const submitForm = async () => {
await form.submit({
onSuccess: (response) => {
onSuccess: () => {
refresh();
},
});
Expand Down Expand Up @@ -110,9 +110,9 @@ Here's a quick summary for people who don't want to leave this page:
- Lifecycle Hooks
- `onBefore()`
- `onStart()`
- `onSuccess(response)` - Runs after the request. Called only if the request is successful.
- `onError(response)` - Runs after the request. Called only if the request fails.
- `onFinish(response)` - Always runs after the request, after `onSuccess` or `onError`
- `onSuccess({ request, options, response })` - Runs after the request. Called only if the request is successful.
- `onError({ request, options, response, errors })` - Runs after the request. Called only if the request fails.
- `onFinish({ request, options, response })` - Always runs after the request, after `onSuccess` or `onError`
- Form State
- `isDirty` - Boolean - Indicates if the form values have been changed since it was instanciated.
- `hasErrors` - Boolean - Indicates if there are validation errors
Expand Down

0 comments on commit 21a4fc9

Please sign in to comment.