fix fetch municipio

This commit is contained in:
Wikzyy
2025-03-14 15:10:40 +07:00
parent 03e33bc937
commit 6878dfd9ee

View File

@ -104,8 +104,8 @@ const AddDialog = () => {
}, [formattedTime]); }, [formattedTime]);
useEffect(() => { useEffect(() => {
try { const fetchMunicipios = async (sorting: any) => {
const fetchMunicipios = async (sorting: any) => { try {
sorting = sorting.length == 0 ? [{ id: 'name', desc: false }] : sorting; sorting = sorting.length == 0 ? [{ id: 'name', desc: false }] : sorting;
const response = await GetData(`${API_URL}/municipios/list`, { const response = await GetData(`${API_URL}/municipios/list`, {
limit: 100, limit: 100,
@ -117,12 +117,12 @@ const AddDialog = () => {
console.log(response?.data); console.log(response?.data);
setMunicipios(response?.data.list); setMunicipios(response?.data.list);
}; } catch (error) {
console.error('Error fetching municipios', error);
}
};
fetchMunicipios([{ id: 'name', desc: false }]); fetchMunicipios([{ id: 'name', desc: false }]);
} catch (error) {
console.error('Error fetching municipios', error);
}
}, []); }, []);
return ( return (