upd: project
Deskripsi: - tambah file - hapus file - upload file pada tambah data - download file blm selesai No Issues
This commit is contained in:
@@ -58,8 +58,8 @@ export default function ProjectAddFile() {
|
||||
|
||||
fd.append("file", {
|
||||
uri: val.uri,
|
||||
type: val.mimeType,
|
||||
name: val.fileName,
|
||||
type: 'application/octet-stream',
|
||||
name: val.name,
|
||||
} as any);
|
||||
|
||||
fd.append(
|
||||
@@ -88,8 +88,8 @@ export default function ProjectAddFile() {
|
||||
for (let i = 0; i < fileForm.length; i++) {
|
||||
fd.append(`file${i}`, {
|
||||
uri: fileForm[i].uri,
|
||||
type: fileForm[i].mimeType,
|
||||
name: fileForm[i].fileName,
|
||||
type: 'application/octet-stream',
|
||||
name: fileForm[i].name,
|
||||
} as any);
|
||||
}
|
||||
|
||||
@@ -100,16 +100,15 @@ export default function ProjectAddFile() {
|
||||
})
|
||||
);
|
||||
|
||||
console.log(fd)
|
||||
|
||||
const response = await apiAddFileProject({ data: fd, id: id })
|
||||
// if (response.success) {
|
||||
// ToastAndroid.show('Berhasil menambahkan file', ToastAndroid.SHORT)
|
||||
// dispatch(setUpdateProject({ ...update, file: !update.file }))
|
||||
// router.back()
|
||||
// } else {
|
||||
// ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
||||
// }
|
||||
if (response.success) {
|
||||
ToastAndroid.show('Berhasil menambahkan file', ToastAndroid.SHORT)
|
||||
dispatch(setUpdateProject({ ...update, file: !update.file }))
|
||||
router.back()
|
||||
} else {
|
||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
ToastAndroid.show('Terjadi kesalahan', ToastAndroid.SHORT)
|
||||
|
||||
Reference in New Issue
Block a user