You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added new callback functions to the handleFormSubmit method in the EventTypeSettings and AvailabilitySettings atoms. The handleFormSubmit method now accepts an optional callbacks object with the following properties:
6
+
7
+
-**onSuccess**: Called when the form submission is successful, allowing additional logic to be executed after the update.
8
+
9
+
-**onError**: Called when an error occurs during form submission, providing details about the error to handle specific cases or display custom messages.
@@ -184,6 +193,20 @@ export function AvailabilityWithValidation() {
184
193
| validateForm | Validates the current availability form state and returns a promise with validation results. |
185
194
| handleFormSubmit | Programmatically submits the availability form, triggering the same validation and submission flow as clicking the save button. Unlike `validateForm`, this method will check required fields and prevent submission unless all required fields are set |
186
195
196
+
### Callbacks
197
+
198
+
The `handleFormSubmit` method accepts an optional callbacks object with the following properties:
199
+
200
+
```typescript
201
+
type AvailabilitySettingsFormCallbacks = {
202
+
onSuccess?: () =>void;
203
+
onError?: (error:Error) =>void;
204
+
};
205
+
```
206
+
207
+
- **onSuccess**: Called when the form submission is successful. This allows you to execute additional logic after a successful update.
208
+
- **onError**: Called when an error occurs during form submission. The error parameter contains details about what went wrong, allowing you to handle specific error cases or display custom error messages.
209
+
187
210
The `validateForm` method returns an `AvailabilityFormValidationResult` object with:
188
211
- `isValid`: Boolean indicating if the form passed validation
189
212
- `errors`: Object containing any validation errors found
@@ -244,6 +253,20 @@ export function EventTypeWithValidation(eventTypeId: number) {
244
253
| validateForm | Validates the current event type form state and returns a promise with validation results. |
245
254
| handleFormSubmit | Programmatically submits the event type form, triggering the same validation and submission flow as clicking the save button. Unlike `validateForm`, this method will check required fields and prevent submission unless all required fields are set |
246
255
256
+
### Callbacks
257
+
258
+
The `handleFormSubmit` method accepts an optional callbacks object with the following properties:
259
+
260
+
```typescript
261
+
type EventTypeFormCallbacks = {
262
+
onSuccess?: () =>void;
263
+
onError?: (error:Error) =>void;
264
+
};
265
+
```
266
+
267
+
- **onSuccess**: Called when the form submission is successful. This allows you to execute additional logic after a successful update.
268
+
- **onError**: Called when an error occurs during form submission. The error parameter contains details about what went wrong, allowing you to handle specific error cases or display custom error messages.
269
+
247
270
The `validateForm` method returns an `EventTypeFormValidationResult` object with:
248
271
- `isValid`: Boolean indicating if the form passed validation
249
272
- `errors`: Object containing any validation errors found
0 commit comments