complete up to request for storing azmayesh_sample and complete design of...

This commit is contained in:
2024-11-04 07:37:46 +00:00
committed by AmirHossein Mahmoodi
parent 510bcba5c3
commit 2777381e52
30 changed files with 924 additions and 85 deletions

View File

@@ -11,18 +11,18 @@ const useProvinces = () => {
useEffect(() => {
const fetchCities = async () => {
try {
const response = await requestServer(`${GET_PROVINCE_LISTS}`); // Fetch the cities from the API
setProvinces(response.data.data); // Set the cities data
setLoadingProvinces(false); // Set loading to false after successful fetch
const response = await requestServer(`${GET_PROVINCE_LISTS}`);
setProvinces(response.data.data);
setLoadingProvinces(false);
} catch (e) {
console.error("Error fetching cities:", e);
console.error("Error fetching provinces:", e);
setErrorProvinces(e);
setLoadingProvinces(false);
}
};
fetchCities(); // Call the fetch function
}, []); // Empty dependency array to ensure it only runs once
fetchCities();
}, []);
return { provinces, loadingProvinces, errorProvinces };
};