mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: project member mutate issue (#1967)
This commit is contained in:
parent
489ef6a3cc
commit
802e6b3e8e
@ -2,7 +2,7 @@ import React, { useEffect } from "react";
|
||||
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
import useSWR, { mutate } from "swr";
|
||||
import useSWR from "swr";
|
||||
|
||||
import { useForm, Controller, useFieldArray } from "react-hook-form";
|
||||
|
||||
@ -28,7 +28,7 @@ import useToast from "hooks/use-toast";
|
||||
// types
|
||||
import { ICurrentUserResponse } from "types";
|
||||
// fetch-keys
|
||||
import { PROJECT_MEMBERS, WORKSPACE_MEMBERS } from "constants/fetch-keys";
|
||||
import { WORKSPACE_MEMBERS } from "constants/fetch-keys";
|
||||
// constants
|
||||
import { ROLE } from "constants/workspace";
|
||||
|
||||
@ -37,6 +37,7 @@ type Props = {
|
||||
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
members: any[];
|
||||
user: ICurrentUserResponse | undefined;
|
||||
onSuccess: () => void;
|
||||
};
|
||||
|
||||
type member = {
|
||||
@ -57,7 +58,9 @@ const defaultValues: FormValues = {
|
||||
],
|
||||
};
|
||||
|
||||
const SendProjectInvitationModal: React.FC<Props> = ({ isOpen, setIsOpen, members, user }) => {
|
||||
const SendProjectInvitationModal: React.FC<Props> = (props) => {
|
||||
const { isOpen, setIsOpen, members, user, onSuccess } = props;
|
||||
|
||||
const router = useRouter();
|
||||
const { workspaceSlug, projectId } = router.query;
|
||||
|
||||
@ -98,13 +101,13 @@ const SendProjectInvitationModal: React.FC<Props> = ({ isOpen, setIsOpen, member
|
||||
type: "success",
|
||||
message: "Member added successfully",
|
||||
});
|
||||
onSuccess();
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
})
|
||||
.finally(() => {
|
||||
reset(defaultValues);
|
||||
mutate(PROJECT_MEMBERS(projectId.toString()));
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -108,6 +108,8 @@ const MembersSettings: NextPage = () => {
|
||||
|
||||
const currentUser = projectMembers?.find((item) => item.member.id === user?.id);
|
||||
|
||||
const handleProjectInvitationSuccess = () => {};
|
||||
|
||||
return (
|
||||
<ProjectAuthorizationWrapper
|
||||
breadcrumbs={
|
||||
@ -167,6 +169,7 @@ const MembersSettings: NextPage = () => {
|
||||
setIsOpen={setInviteModal}
|
||||
members={members}
|
||||
user={user}
|
||||
onSuccess={() => mutateMembers()}
|
||||
/>
|
||||
<div className="p-8">
|
||||
<SettingsHeader />
|
||||
|
Loading…
Reference in New Issue
Block a user