diff --git a/app/component/modalSearchCity/Content.js b/app/component/modalSearchCity/Content.js index fb223e6..985f740 100644 --- a/app/component/modalSearchCity/Content.js +++ b/app/component/modalSearchCity/Content.js @@ -18,7 +18,7 @@ function Content({ const { matchedState } = getStateInfoClient(); const handleClick = () => { handleClose(); - sendReq(); + sendReq(filter); }; const updateData = (name, value) => { diff --git a/components/doctors/head/index.js b/components/doctors/head/index.js index 4fcbe17..1a02045 100644 --- a/components/doctors/head/index.js +++ b/components/doctors/head/index.js @@ -7,7 +7,7 @@ import { QueryForDoctorsFilter, QueryForDoctorsReq } from "@/helper"; import { request } from "@/services/response"; import FilterLocate from "./FilterLocate"; -function Head({ filter, setFilter, setPage, setDoctors }) { +function Head({ filter, setFilter, setPage, setDoctors, setLoading }) { const router = useRouter(); const setDataInURL = (newFilter) => { @@ -38,6 +38,7 @@ function Head({ filter, setFilter, setPage, setDoctors }) { filteredName.page = 1; filteredName.limit = 12; setPage(1); + setLoading(true); return request .getDoctors(filteredName) @@ -47,6 +48,9 @@ function Head({ filter, setFilter, setPage, setDoctors }) { }) .catch((err) => { throw err; + }) + .finally(() => { + setLoading(false); }); }; diff --git a/components/doctors/index.js b/components/doctors/index.js index 3a3474a..77cdf1e 100644 --- a/components/doctors/index.js +++ b/components/doctors/index.js @@ -45,6 +45,7 @@ function DoctorsPage({ matchedCity, matchedState, list }) { }; const [filter, setFilter] = useState(defaultFilter); + const [loading, setLoading] = useState(false); return (