mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
25 lines
579 B
TypeScript
25 lines
579 B
TypeScript
|
// api routes
|
||
|
import { S3_URL } from "constants/api-routes";
|
||
|
// services
|
||
|
import APIService from "lib/services/api.service";
|
||
|
|
||
|
const { NEXT_PUBLIC_API_BASE_URL } = process.env;
|
||
|
|
||
|
class FileServices extends APIService {
|
||
|
constructor() {
|
||
|
super(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();
|