Fix: Investasi
Deskripsi: - Upload gambar investasi ke storage wibu - Upload bukti transfer ke storage wibu # No Issue
This commit is contained in:
24
src/app_modules/_global/fun/delete/fun_delete_file_by_id.tsx
Normal file
24
src/app_modules/_global/fun/delete/fun_delete_file_by_id.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
export async function funGlobal_DeleteFileById({ fileId }: { fileId: string }) {
|
||||
try {
|
||||
const res = await fetch(
|
||||
`https://wibu-storage.wibudev.com/api/files/${fileId}/delete`,
|
||||
{
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
Authorization: `Bearer ${process.env.WS_APIKEY}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
if (res.ok) {
|
||||
const hasil = await res.json();
|
||||
return { success: true };
|
||||
} else {
|
||||
const errorText = await res.json();
|
||||
return { success: false };
|
||||
}
|
||||
} catch (error) {
|
||||
return { success: false };
|
||||
console.error("Upload error:", error);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
import { funGlobal_DeleteFileById } from "./delete/fun_delete_file_by_id";
|
||||
import { funGlobal_UploadToStorage } from "./upload/fun_upload_to_storage";
|
||||
|
||||
export { funGlobal_UploadToStorage };
|
||||
export { funGlobal_DeleteFileById };
|
||||
|
||||
Reference in New Issue
Block a user