import { useState } from "react"; import Image from "next/image"; import { useRouter } from "next/router"; import { mutate } from "swr"; // services import { ProjectService } from "services/project"; // ui import { Button } from "@plane/ui"; // icons import { AssignmentClipboardIcon } from "components/icons"; // images import JoinProjectImg from "public/auth/project-not-authorized.svg"; // fetch-keys import { USER_PROJECT_VIEW } from "constants/fetch-keys"; const projectService = new ProjectService(); export const JoinProject: React.FC = () => { const [isJoiningProject, setIsJoiningProject] = useState(false); const router = useRouter(); const { workspaceSlug, projectId } = router.query; const handleJoin = () => { if (!workspaceSlug || !projectId) return; setIsJoiningProject(true); projectService .joinProject(workspaceSlug as string, [projectId as string]) .then(async () => { await mutate(USER_PROJECT_VIEW(projectId.toString())); setIsJoiningProject(false); }) .catch((err) => { console.error(err); setIsJoiningProject(false); }); }; return (
You are not a member of this project, but you can join this project by clicking the button below.