import { useState } from "react"; import Image from "next/image"; import { useRouter } from "next/router"; import { mutate } from "swr"; // services import projectService from "services/project.service"; // ui import { PrimaryButton } from "components/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"; 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, { project_ids: [projectId as string], }) .then(async () => { await mutate(USER_PROJECT_VIEW(projectId.toString())); setIsJoiningProject(false); }) .catch((err) => { console.error(err); setIsJoiningProject(false); }); }; return (
JoinProject

You are not a member of this project

You are not a member of this project, but you can join this project by clicking the button below.

{isJoiningProject ? "Joining..." : "Click to join"}
); };