plane/web/services/project/project_invitation.service.ts
2023-10-31 12:16:40 +05:30

36 lines
1.3 KiB
TypeScript

import { API_BASE_URL } from "helpers/common.helper";
// services
import { APIService } from "services/api.service";
// types
import { IProjectMemberInvitation } from "types";
export class ProjectInvitationService extends APIService {
constructor() {
super(API_BASE_URL);
}
async fetchProjectInvitations(workspaceSlug: string, projectId: string): Promise<IProjectMemberInvitation[]> {
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/invitations/`)
.then((response) => response?.data)
.catch((error) => {
throw error?.response?.data;
});
}
async updateProjectInvitation(workspaceSlug: string, projectId: string, invitationId: string): Promise<any> {
return this.put(`/api/workspaces/${workspaceSlug}/projects/${projectId}/invitations/${invitationId}/`)
.then((response) => response?.data)
.catch((error) => {
throw error?.response?.data;
});
}
async deleteProjectInvitation(workspaceSlug: string, projectId: string, invitationId: string): Promise<any> {
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/invitations/${invitationId}/`)
.then((response) => response?.data)
.catch((error) => {
throw error?.response?.data;
});
}
}