fix(notifications): ensure schedule_at field has default value on submit
- Add default value of 0 for schedule_at field when not provided - Restructure credentials object to explicitly set schedule_at before mutation - Prevent undefined values from being sent to the API when schedule_at is empty
This commit is contained in:
@@ -38,7 +38,11 @@ const useCreateNotificationFormPresenter = () => {
|
|||||||
reset();
|
reset();
|
||||||
});
|
});
|
||||||
const onSubmit: SubmitHandler<TCreateNotificationCredentials> = (data) => {
|
const onSubmit: SubmitHandler<TCreateNotificationCredentials> = (data) => {
|
||||||
mutate({ credentials: data });
|
const credentials = {
|
||||||
|
...data,
|
||||||
|
schedule_at: data.schedule_at || 0,
|
||||||
|
};
|
||||||
|
mutate({ credentials });
|
||||||
};
|
};
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
reset();
|
reset();
|
||||||
|
|||||||
Reference in New Issue
Block a user