From ad22ff222fe4ba7d0e331c6fecf6a11ddfa03a2b Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Tue, 28 Nov 2023 11:30:03 +0530 Subject: [PATCH] chore: update get invitation details endpoint (#2902) --- web/pages/workspace-invitations/index.tsx | 8 +++++--- web/services/workspace.service.ts | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/web/pages/workspace-invitations/index.tsx b/web/pages/workspace-invitations/index.tsx index 784dc166f..32cb61432 100644 --- a/web/pages/workspace-invitations/index.tsx +++ b/web/pages/workspace-invitations/index.tsx @@ -24,13 +24,15 @@ const workspaceService = new WorkspaceService(); const WorkspaceInvitationPage: NextPageWithLayout = () => { const router = useRouter(); - const { invitation_id, email } = router.query; + const { invitation_id, email, slug } = router.query; const { user } = useUser(); const { data: invitationDetail, error } = useSWR( - invitation_id && WORKSPACE_INVITATION(invitation_id.toString()), - () => (invitation_id ? workspaceService.getWorkspaceInvitation(invitation_id as string) : null) + invitation_id && slug && WORKSPACE_INVITATION(invitation_id.toString()), + invitation_id && slug + ? () => workspaceService.getWorkspaceInvitation(slug.toString(), invitation_id.toString()) + : null ); const handleAccept = () => { diff --git a/web/services/workspace.service.ts b/web/services/workspace.service.ts index e64be236d..3fb3b4b2f 100644 --- a/web/services/workspace.service.ts +++ b/web/services/workspace.service.ts @@ -157,8 +157,8 @@ export class WorkspaceService extends APIService { }); } - async getWorkspaceInvitation(invitationId: string): Promise { - return this.get(`/api/users/me/invitations/${invitationId}/`, { headers: {} }) + async getWorkspaceInvitation(workspaceSlug: string, invitationId: string): Promise { + return this.get(`/api/workspaces/${workspaceSlug}/invitations/${invitationId}/join/`, { headers: {} }) .then((response) => response?.data) .catch((error) => { throw error?.response?.data;