Files
hipmi-mobile/service/api-client/api-file.ts
Bagasbanuna02 bb95e8ccbd API
Add:
- service/api-client/api-file.ts: upload & delete

Portofolio
Fix:
- user)/portofolio/[id]/create.tsx: Loading submit
- (user)/portofolio/[id]/index.tsx: Delete button recode

Profile
Fix:
- (user)/profile/[id]/update-photo && upload-backgroud: delete image yang kama

### No Issue
2025-09-01 12:11:21 +08:00

46 lines
837 B
TypeScript

import axios from "axios";
import { API_BASE_URL } from "../api-config";
const url = `${API_BASE_URL}/mobile/file`;
export async function apiFileUpload({
token,
formData,
}: {
token: string;
formData: FormData;
}) {
try {
const response = await axios.post(url, formData, {
headers: {
"Content-Type": "multipart/form-data",
Authorization: `Bearer ${token}`,
},
// timeout: 30000,
});
return response.data;
} catch (error) {
throw error;
}
}
export async function apiFileDelete({
token,
id,
}: {
token: string;
id: string;
}) {
try {
const response = await axios.delete(`${url}/${id}`, {
headers: {
Authorization: `Bearer ${token}`,
},
// timeout: 30000,
});
return response.data;
} catch (error) {
throw error;
}
}