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
This commit is contained in:
45
service/api-client/api-file.ts
Normal file
45
service/api-client/api-file.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user