import { useState } from "react"; import Image from "next/image"; import { useRouter } from "next/router"; import { mutate } from "swr"; // ui import { PrimaryButton } from "components/ui"; // icon import { AssignmentClipboardIcon } from "components/icons"; // img import JoinProjectImg from "public/auth/project-not-authorized.svg"; import projectService from "services/project.service"; // fetch-keys import { PROJECT_MEMBERS } from "constants/fetch-keys"; export const JoinProject: React.FC = () => { const [isJoiningProject, setIsJoiningProject] = useState(false); const router = useRouter(); const { workspaceSlug, projectId } = router.query; const handleJoin = () => { setIsJoiningProject(true); projectService .joinProject(workspaceSlug as string, { project_ids: [projectId as string], }) .then(() => { mutate(PROJECT_MEMBERS(projectId as string)); }) .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"}
); };