fix(invites): creation with custom expiration not working (#4677)
This commit is contained in:
@@ -13,7 +13,7 @@ import { InviteCopyModal } from "./invite-copy-modal";
|
|||||||
dayjs.extend(relativeTime);
|
dayjs.extend(relativeTime);
|
||||||
|
|
||||||
interface FormType {
|
interface FormType {
|
||||||
expirationDate: Date;
|
expirationDate: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const InviteCreateModal = createModal<void>(({ actions }) => {
|
export const InviteCreateModal = createModal<void>(({ actions }) => {
|
||||||
@@ -28,18 +28,23 @@ export const InviteCreateModal = createModal<void>(({ actions }) => {
|
|||||||
|
|
||||||
const form = useForm<FormType>({
|
const form = useForm<FormType>({
|
||||||
initialValues: {
|
initialValues: {
|
||||||
expirationDate: dayjs().add(4, "hours").toDate(),
|
expirationDate: dayjs().add(4, "hours").toDate().toISOString(),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleSubmit = (values: FormType) => {
|
const handleSubmit = (values: FormType) => {
|
||||||
mutate(values, {
|
mutate(
|
||||||
onSuccess: (result) => {
|
{
|
||||||
void utils.invite.getAll.invalidate();
|
expirationDate: new Date(values.expirationDate),
|
||||||
actions.closeModal();
|
|
||||||
openModal(result);
|
|
||||||
},
|
},
|
||||||
});
|
{
|
||||||
|
onSuccess: (result) => {
|
||||||
|
void utils.invite.getAll.invalidate();
|
||||||
|
actions.closeModal();
|
||||||
|
openModal(result);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user