diff --git a/app/component/modalSearchCity/Content.js b/app/component/modalSearchCity/Content.js index 4c2d5c1..b92a954 100644 --- a/app/component/modalSearchCity/Content.js +++ b/app/component/modalSearchCity/Content.js @@ -5,32 +5,44 @@ import CloseModalD from "@/components/icons/CloseModalD"; import ArrowLeftM from "@/components/icons/ArrowLeftM"; import { useState } from "react"; import AddressSelector from "./AddressSelector"; +import { getStateInfoClient } from "@/lib/getStateInfoClient"; function Content({ - state, states, filter, + sendReq, setFilter, handleClose, - modalLocate, + setDataInURL, filteredCities, }) { const [loading, setLoading] = useState(false); + const { matchedState } = getStateInfoClient(); + const handleClick = () => { + setLoading(true); + sendReq().finally(() => { + console.log("asd"); + + setLoading(false); + handleClose(); + }); + }; const updateData = (name, value) => { - setFilter((prev) => { - if (name === "state") { - return { - ...prev, - state: value, - city: null, - }; - } - return { - ...prev, - [name]: value, - }; - }); + const newFilter = + name === "state" + ? { + ...filter, + state: value, + city: null, + } + : { + ...filter, + [name]: value, + }; + + setDataInURL(newFilter); + setFilter(newFilter); }; return ( @@ -49,7 +61,7 @@ function Content({ name="state" list={states} label="استان" - disabled={state} + disabled={matchedState} value={filter.state} updateData={updateData} /> @@ -66,7 +78,7 @@ function Content({