|
|
@@ -154,6 +154,7 @@ class App extends Component {
|
|
|
formdata.append("keterangan", data.keterangan);
|
|
|
formdata.append("pelanggaran_id", data.pelanggaran_id.join(","));
|
|
|
formdata.append("foto", data.foto[0]);
|
|
|
+
|
|
|
if (data.dokumen.length > 0) {
|
|
|
Array.from(data.dokumen).forEach((e) => {
|
|
|
formdata.append("dokumen", e);
|
|
|
@@ -163,9 +164,11 @@ class App extends Component {
|
|
|
const toastid = toast.loading("Please wait...");
|
|
|
const success = await createLaporanPublic(formdata);
|
|
|
if (!success) {
|
|
|
- toast.update(toastid, { render: "All is not good", type: "error", isLoading: false, autoClose: true, closeButton: true });
|
|
|
+ // toast.update(toastid, { render: "All is not good", type: "error", isLoading: false, autoClose: true, closeButton: true });
|
|
|
+ swal("Data tidak berhasil dikirim", " ", "error");
|
|
|
} else {
|
|
|
- toast.update(toastid, { render: "All is good", type: "success", isLoading: false, autoClose: true, closeButton: true });
|
|
|
+ // toast.update(toastid, { render: "All is good", type: "success", isLoading: false, autoClose: true, closeButton: true });
|
|
|
+ swal("Data berhasil dikirim", " ", "success");
|
|
|
Router.push("/laporan/new");
|
|
|
}
|
|
|
};
|
|
|
@@ -185,13 +188,15 @@ class App extends Component {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- const toastid = toast.loading("Please wait...");
|
|
|
+ // const toastid = toast.loading("Please wait...");
|
|
|
const success = await createLaporanPublic(token, formdata);
|
|
|
if (!success) {
|
|
|
- toast.update(toastid, { render: "All is not good", type: "error", isLoading: false, autoClose: true, closeButton: true });
|
|
|
+ // toast.update(toastid, { render: "All is not good", type: "error", isLoading: false, autoClose: true, closeButton: true });
|
|
|
+ swal("Data tidak berhasil dikirim", "Kode verifikasi tidak valid", "error");
|
|
|
this.setState({ error: "Kode verifikasi tidak valid" });
|
|
|
} else {
|
|
|
- toast.update(toastid, { render: "All is good", type: "success", isLoading: false, autoClose: true, closeButton: true });
|
|
|
+ // toast.update(toastid, { render: "All is good", type: "success", isLoading: false, autoClose: true, closeButton: true });
|
|
|
+ swal("Data berhasil dikirim", " ", "success");
|
|
|
this.toggleModal();
|
|
|
Router.push("/laporan/new");
|
|
|
}
|