chore: update get invitation details endpoint (#2902)

This commit is contained in:
Aaryan Khandelwal 2023-11-28 11:30:03 +05:30 committed by GitHub
parent c22c6bb9b2
commit 41ab962dd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -24,13 +24,15 @@ const workspaceService = new WorkspaceService();
const WorkspaceInvitationPage: NextPageWithLayout = () => { const WorkspaceInvitationPage: NextPageWithLayout = () => {
const router = useRouter(); const router = useRouter();
const { invitation_id, email } = router.query; const { invitation_id, email, slug } = router.query;
const { user } = useUser(); const { user } = useUser();
const { data: invitationDetail, error } = useSWR( const { data: invitationDetail, error } = useSWR(
invitation_id && WORKSPACE_INVITATION(invitation_id.toString()), invitation_id && slug && WORKSPACE_INVITATION(invitation_id.toString()),
() => (invitation_id ? workspaceService.getWorkspaceInvitation(invitation_id as string) : null) invitation_id && slug
? () => workspaceService.getWorkspaceInvitation(slug.toString(), invitation_id.toString())
: null
); );
const handleAccept = () => { const handleAccept = () => {

View File

@ -157,8 +157,8 @@ export class WorkspaceService extends APIService {
}); });
} }
async getWorkspaceInvitation(invitationId: string): Promise<IWorkspaceMemberInvitation> { async getWorkspaceInvitation(workspaceSlug: string, invitationId: string): Promise<IWorkspaceMemberInvitation> {
return this.get(`/api/users/me/invitations/${invitationId}/`, { headers: {} }) return this.get(`/api/workspaces/${workspaceSlug}/invitations/${invitationId}/join/`, { headers: {} })
.then((response) => response?.data) .then((response) => response?.data)
.catch((error) => { .catch((error) => {
throw error?.response?.data; throw error?.response?.data;