forked from github/plane
chore: update join project endpoint (#2821)
This commit is contained in:
parent
982eba0bd1
commit
561223ea71
@ -21,22 +21,21 @@ export const JoinProjectModal: React.FC<TJoinProjectModalProps> = (props) => {
|
|||||||
// states
|
// states
|
||||||
const [isJoiningLoading, setIsJoiningLoading] = useState(false);
|
const [isJoiningLoading, setIsJoiningLoading] = useState(false);
|
||||||
// store
|
// store
|
||||||
const { project: projectStore } = useMobxStore();
|
const {
|
||||||
|
project: { joinProject },
|
||||||
|
} = useMobxStore();
|
||||||
// router
|
// router
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const handleJoin = () => {
|
const handleJoin = () => {
|
||||||
setIsJoiningLoading(true);
|
setIsJoiningLoading(true);
|
||||||
|
|
||||||
projectStore
|
joinProject(workspaceSlug, [project.id])
|
||||||
.joinProject(workspaceSlug, [project.id])
|
|
||||||
.then(() => {
|
.then(() => {
|
||||||
setIsJoiningLoading(false);
|
|
||||||
|
|
||||||
router.push(`/${workspaceSlug}/projects/${project.id}/issues`);
|
router.push(`/${workspaceSlug}/projects/${project.id}/issues`);
|
||||||
handleClose();
|
handleClose();
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.finally(() => {
|
||||||
setIsJoiningLoading(false);
|
setIsJoiningLoading(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -73,8 +72,9 @@ export const JoinProjectModal: React.FC<TJoinProjectModalProps> = (props) => {
|
|||||||
Join Project?
|
Join Project?
|
||||||
</Dialog.Title>
|
</Dialog.Title>
|
||||||
<p>
|
<p>
|
||||||
Are you sure you want to join the project <span className="font-semibold break-words">{project?.name}</span>?
|
Are you sure you want to join the project{" "}
|
||||||
Please click the 'Join Project' button below to continue.
|
<span className="font-semibold break-words">{project?.name}</span>? Please click the 'Join
|
||||||
|
Project' button below to continue.
|
||||||
</p>
|
</p>
|
||||||
<div className="space-y-3" />
|
<div className="space-y-3" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -69,7 +69,7 @@ export class ProjectService extends APIService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async joinProject(workspaceSlug: string, project_ids: string[]): Promise<any> {
|
async joinProject(workspaceSlug: string, project_ids: string[]): Promise<any> {
|
||||||
return this.post(`/api/workspaces/${workspaceSlug}/projects/join/`, { project_ids })
|
return this.post(`/api/users/me/workspaces/${workspaceSlug}/projects/invitations/`, { project_ids })
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
throw error?.response?.data;
|
throw error?.response?.data;
|
||||||
|
Loading…
Reference in New Issue
Block a user