mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: join project mutation (#835)
* fix: join project mutation * chore: remove imports
This commit is contained in:
parent
8638170a98
commit
363c5c8ec4
@ -5,15 +5,16 @@ import { useRouter } from "next/router";
|
||||
|
||||
import { mutate } from "swr";
|
||||
|
||||
// services
|
||||
import projectService from "services/project.service";
|
||||
// ui
|
||||
import { PrimaryButton } from "components/ui";
|
||||
// icon
|
||||
// icons
|
||||
import { AssignmentClipboardIcon } from "components/icons";
|
||||
// img
|
||||
// images
|
||||
import JoinProjectImg from "public/auth/project-not-authorized.svg";
|
||||
import projectService from "services/project.service";
|
||||
// fetch-keys
|
||||
import { PROJECT_MEMBERS } from "constants/fetch-keys";
|
||||
import { USER_PROJECT_VIEW } from "constants/fetch-keys";
|
||||
|
||||
export const JoinProject: React.FC = () => {
|
||||
const [isJoiningProject, setIsJoiningProject] = useState(false);
|
||||
@ -22,13 +23,16 @@ export const JoinProject: React.FC = () => {
|
||||
const { workspaceSlug, projectId } = router.query;
|
||||
|
||||
const handleJoin = () => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
|
||||
setIsJoiningProject(true);
|
||||
projectService
|
||||
.joinProject(workspaceSlug as string, {
|
||||
project_ids: [projectId as string],
|
||||
})
|
||||
.then(() => {
|
||||
mutate(PROJECT_MEMBERS(projectId as string));
|
||||
.then(async () => {
|
||||
await mutate(USER_PROJECT_VIEW(workspaceSlug.toString()));
|
||||
setIsJoiningProject(false);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
|
Loading…
Reference in New Issue
Block a user