|
@@ -9,6 +9,9 @@ import { getLogPublic } from "@/actions/log";
|
|
|
import Timeline from "@/components/Main/Timeline";
|
|
import Timeline from "@/components/Main/Timeline";
|
|
|
import { Formik, Form, Field, ErrorMessage } from "formik";
|
|
import { Formik, Form, Field, ErrorMessage } from "formik";
|
|
|
import * as Yup from "yup";
|
|
import * as Yup from "yup";
|
|
|
|
|
+import { ToastContainer, toast } from "react-toastify";
|
|
|
|
|
+
|
|
|
|
|
+import "react-toastify/dist/ReactToastify.css";
|
|
|
|
|
|
|
|
const menu = [
|
|
const menu = [
|
|
|
{
|
|
{
|
|
@@ -52,18 +55,26 @@ class App extends Component {
|
|
|
|
|
|
|
|
handleLihatPemantaun = async (data) => {
|
|
handleLihatPemantaun = async (data) => {
|
|
|
const { no_hp, no_laporan } = data;
|
|
const { no_hp, no_laporan } = data;
|
|
|
|
|
+ const toastid = toast.loading("Please wait...");
|
|
|
const log = await getLogPublic({ no_hp, no_laporan });
|
|
const log = await getLogPublic({ no_hp, no_laporan });
|
|
|
- this.setState({ laporan: log.data.laporan });
|
|
|
|
|
- this.setState({ log: log.data.pemantauan });
|
|
|
|
|
|
|
+ if (log.data) {
|
|
|
|
|
+ this.setState({ laporan: log.data.laporan, log: log.data.pemantauan });
|
|
|
|
|
+ toast.update(toastid, { render: "Berhasil mendapatkan data Pemantauan", type: "success", isLoading: false, autoClose: true, closeButton: true });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.setState({ laporan: null, log: null });
|
|
|
|
|
+ toast.update(toastid, { render: "Pemantauan tidak ada", type: "error", isLoading: false, autoClose: true, closeButton: true });
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
render() {
|
|
|
const { laporan, log } = this.state;
|
|
const { laporan, log } = this.state;
|
|
|
return (
|
|
return (
|
|
|
<div>
|
|
<div>
|
|
|
|
|
+ <ToastContainer />
|
|
|
<Navbar className="navbar-color" expand="md" dark>
|
|
<Navbar className="navbar-color" expand="md" dark>
|
|
|
<NavbarBrand href="/">
|
|
<NavbarBrand href="/">
|
|
|
- <img className="img-fluid" src="/static/img/Logo-vputih.png" alt="App Logo" /><img className="img-text-vputih" src="/static/img/Logo-text-vputih.png" alt="App Logo" />
|
|
|
|
|
|
|
+ <img className="img-fluid" src="/static/img/Logo-vputih.png" alt="App Logo" />
|
|
|
|
|
+ <img className="img-text-vputih" src="/static/img/Logo-text-vputih.png" alt="App Logo" />
|
|
|
</NavbarBrand>
|
|
</NavbarBrand>
|
|
|
<NavbarToggler onClick={this.toggleCollapse} />
|
|
<NavbarToggler onClick={this.toggleCollapse} />
|
|
|
<Collapse isOpen={this.state.isOpen} navbar>
|
|
<Collapse isOpen={this.state.isOpen} navbar>
|