fix: workspace member invitation mutate (#1721)

* fix: workspace member invitation mutate

* fix: mutate on finally
This commit is contained in:
Dakshesh Jain 2023-07-31 16:58:45 +05:30 committed by GitHub
parent 0586d30a33
commit c9498fa54d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,7 @@
import React, { useEffect } from "react";
// swr
import { mutate } from "swr";
// react-hook-form
import { Controller, useFieldArray, useForm } from "react-hook-form";
// headless
@ -13,9 +15,10 @@ import { CustomSelect, Input, PrimaryButton, SecondaryButton } from "components/
// icons
import { PlusIcon, XMarkIcon } from "@heroicons/react/24/outline";
// types
import { ICurrentUserResponse, IWorkspace, IWorkspaceMemberInvitation } from "types";
import { ICurrentUserResponse } from "types";
// constants
import { ROLE } from "constants/workspace";
import { WORKSPACE_INVITATIONS } from "constants/fetch-keys";
type Props = {
isOpen: boolean;
@ -94,7 +97,10 @@ const SendWorkspaceInvitationModal: React.FC<Props> = ({
});
console.log(err);
})
.finally(() => reset(defaultValues));
.finally(() => {
reset(defaultValues);
mutate(WORKSPACE_INVITATIONS);
});
};
const appendField = () => {