Skip to content

Commit 0ee5670

Browse files
committed
fix(state): sunting STATE handling
1 parent 2ded403 commit 0ee5670

File tree

1 file changed

+21
-28
lines changed
  • app/dashboard/state/details/[stateID]

1 file changed

+21
-28
lines changed

app/dashboard/state/details/[stateID]/page.tsx

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -426,35 +426,28 @@ export default function Details() {
426426
<form
427427
// to handle multipart, please use formData :)
428428
onSubmit={handleSubmit((data) => {
429-
// const formData = new FormData();
430-
// formData.append("name", data.name);
431-
// formData.append("day", data.day);
432-
// formData.append("stateDesc", data.stateDesc);
433-
// formData.append("location", data.location);
434-
// formData.append("quota", data.quota.toString());
435-
// formData.append("test_file", data.stateLogo);
429+
const formData = new FormData();
430+
formData.append("name", data.name);
431+
formData.append("day", data.day);
432+
formData.append("stateDesc", data.stateDesc);
433+
formData.append("location", data.location);
434+
formData.append("quota", data.quota.toString());
435+
formData.append("test_file", data.stateLogo);
436436

437-
// api
438-
// .post(`/stateAct/createState/`, formData, {
439-
// headers: {
440-
// "Content-Type": "multipart/form-data",
441-
// },
442-
// })
443-
// .then((res) => {
444-
// // refetch
445-
// loadDataState();
446-
// Swal.fire(
447-
// "Berhasil!",
448-
// "Berhasil membuat STATE",
449-
// "success"
450-
// );
451-
// })
452-
// .catch((err) => {
453-
// HandleAxiosError(err);
454-
// });
455-
456-
console.log(data);
457-
alert("NOT IMPLEMENTED, please check console");
437+
api
438+
.put(`/stateAct/update/`, formData, {
439+
headers: {
440+
"Content-Type": "multipart/form-data",
441+
},
442+
})
443+
.then((res) => {
444+
// refetch
445+
loadDataState();
446+
Swal.fire("Berhasil!", "Berhasil mengubah STATE", "success");
447+
})
448+
.catch((err) => {
449+
HandleAxiosError(err);
450+
});
458451

459452
onClose();
460453
})}

0 commit comments

Comments
 (0)