plane/web/services/csv.services.ts
sriram veeraghanta a328c530d0 chore: store setup
2023-09-20 20:33:25 +05:30

37 lines
915 B
TypeScript

import APIService from "services/api.service";
import trackEventServices from "services/track_event.service";
import { ICurrentUserResponse } from "types";
import { API_BASE_URL } from "helpers/common.helper";
export class CSVIntegrationService extends APIService {
constructor() {
super(API_BASE_URL);
}
async exportCSVService(
workspaceSlug: string,
data: {
provider: string;
project: string[];
},
user: ICurrentUserResponse
): Promise<any> {
return this.post(`/api/workspaces/${workspaceSlug}/export-issues/`, data)
.then((response) => {
trackEventServices.trackExporterEvent(
{
workspaceSlug,
},
"CSV_EXPORTER_CREATE",
user
);
return response?.data;
})
.catch((error) => {
throw error?.response?.data;
});
}
}
export default new CSVIntegrationService();