|  | @@ -170,7 +170,7 @@ class App extends Component {
 | 
											
												
													
														|  |  		}
 |  |  		}
 | 
											
												
													
														|  |  	};
 |  |  	};
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -	createLaporan = async (token, kode = "") => {
 |  | 
 | 
											
												
													
														|  | 
 |  | +	createLaporan = async (token, kode = "", toastid = null) => {
 | 
											
												
													
														|  |  		const data = this.state.data;
 |  |  		const data = this.state.data;
 | 
											
												
													
														|  |  		const formdata = new FormData();
 |  |  		const formdata = new FormData();
 | 
											
												
													
														|  |  		formdata.append("pt_id", data.pt_id);
 |  |  		formdata.append("pt_id", data.pt_id);
 | 
											
										
											
												
													
														|  | @@ -185,13 +185,14 @@ class App extends Component {
 | 
											
												
													
														|  |  			});
 |  |  			});
 | 
											
												
													
														|  |  		}
 |  |  		}
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -		const toastid = toast.loading("Please wait...");
 |  | 
 | 
											
												
													
														|  | 
 |  | +		let toastid2 = toastid;
 | 
											
												
													
														|  | 
 |  | +		if (!toastid) toastid2 = toast.loading("Please wait...");
 | 
											
												
													
														|  |  		const success = await createLaporanPublic(token, formdata);
 |  |  		const success = await createLaporanPublic(token, formdata);
 | 
											
												
													
														|  |  		if (!success) {
 |  |  		if (!success) {
 | 
											
												
													
														|  | -			toast.update(toastid, { render: "All is not good", type: "error", isLoading: false, autoClose: true, closeButton: true });
 |  | 
 | 
											
												
													
														|  | 
 |  | +			toast.update(toastid2, { render: "All is not good", type: "error", isLoading: false, autoClose: true, closeButton: true });
 | 
											
												
													
														|  |  			this.setState({ error: "Kode verifikasi tidak valid" });
 |  |  			this.setState({ error: "Kode verifikasi tidak valid" });
 | 
											
												
													
														|  |  		} else {
 |  |  		} else {
 | 
											
												
													
														|  | -			toast.update(toastid, { render: "All is good", type: "success", isLoading: false, autoClose: true, closeButton: true });
 |  | 
 | 
											
												
													
														|  | 
 |  | +			toast.update(toastid2, { render: "All is good", type: "success", isLoading: false, autoClose: true, closeButton: true });
 | 
											
												
													
														|  |  			this.toggleModal();
 |  |  			this.toggleModal();
 | 
											
												
													
														|  |  			Router.push("/laporan/new");
 |  |  			Router.push("/laporan/new");
 | 
											
												
													
														|  |  		}
 |  |  		}
 | 
											
										
											
												
													
														|  | @@ -255,11 +256,17 @@ class App extends Component {
 | 
											
												
													
														|  |  										}}
 |  |  										}}
 | 
											
												
													
														|  |  										validationSchema={laporanSchema}
 |  |  										validationSchema={laporanSchema}
 | 
											
												
													
														|  |  										onSubmit={async (data) => {
 |  |  										onSubmit={async (data) => {
 | 
											
												
													
														|  | -											this.toggleModal();
 |  | 
 | 
											
												
													
														|  |  											this.setState({ data, no_hp: data.no_hp });
 |  |  											this.setState({ data, no_hp: data.no_hp });
 | 
											
												
													
														|  | 
 |  | +											const toastid = toast.loading("Please wait...");
 | 
											
												
													
														|  |  											const user = await this.createUser(data);
 |  |  											const user = await this.createUser(data);
 | 
											
												
													
														|  |  											const token = user.data.token;
 |  |  											const token = user.data.token;
 | 
											
												
													
														|  |  											this.setState({ user, token });
 |  |  											this.setState({ user, token });
 | 
											
												
													
														|  | 
 |  | +											if (user.data.no_hp_aktif) {
 | 
											
												
													
														|  | 
 |  | +												toast.update(toastid, { render: "All is good", type: "success", isLoading: false, autoClose: true, closeButton: true });
 | 
											
												
													
														|  | 
 |  | +												this.toggleModal();
 | 
											
												
													
														|  | 
 |  | +											} else {
 | 
											
												
													
														|  | 
 |  | +												await this.createLaporan(token, null, toastid);
 | 
											
												
													
														|  | 
 |  | +											}
 | 
											
												
													
														|  |  										}}
 |  |  										}}
 | 
											
												
													
														|  |  									>
 |  |  									>
 | 
											
												
													
														|  |  										<Form className="form-horizontal">
 |  |  										<Form className="form-horizontal">
 | 
											
										
											
												
													
														|  | @@ -421,10 +428,11 @@ class App extends Component {
 | 
											
												
													
														|  |  								<Button
 |  |  								<Button
 | 
											
												
													
														|  |  									color="info"
 |  |  									color="info"
 | 
											
												
													
														|  |  									onClick={async () => {
 |  |  									onClick={async () => {
 | 
											
												
													
														|  | -										await this.createLaporan(this.state.token);
 |  | 
 | 
											
												
													
														|  | 
 |  | +										this.toggleModal();
 | 
											
												
													
														|  | 
 |  | +										this.setState({ error: "", kode: "" });
 | 
											
												
													
														|  |  									}}
 |  |  									}}
 | 
											
												
													
														|  |  								>
 |  |  								>
 | 
											
												
													
														|  | -									Tidak memiliki Kode Verifikasi
 |  | 
 | 
											
												
													
														|  | 
 |  | +									Kembali
 | 
											
												
													
														|  |  								</Button>
 |  |  								</Button>
 | 
											
												
													
														|  |  								<Button
 |  |  								<Button
 | 
											
												
													
														|  |  									color="primary"
 |  |  									color="primary"
 |