plane/apps/app/lib/services/file.services.ts
2022-12-01 01:06:28 +05:30

23 lines
540 B
TypeScript

// api routes
import { S3_URL } from "constants/api-routes";
// services
import APIService from "lib/services/api.service";
class FileServices extends APIService {
constructor() {
super(process.env.NEXT_PUBLIC_API_BASE_URL || "http://localhost:8000");
}
async uploadFile(file: FormData): Promise<any> {
return this.mediaUpload(S3_URL, file)
.then((response) => {
return response?.data;
})
.catch((error) => {
throw error?.response?.data;
});
}
}
export default new FileServices();