Loading web/src/hooks/usePlaceRegister.tsx→web/src/hooks/usePlace.tsx +13 −5 Original line number Diff line number Diff line Loading @@ -122,7 +122,7 @@ const resolver: Resolver<Place> = async (data) => { }; }; export const usePlaceRegister = () => { export const usePlace = () => { const { register, handleSubmit, Loading @@ -135,9 +135,11 @@ export const usePlaceRegister = () => { const [languageDescriptionIndexSelected, setLanguageDescriptionIndexSelected] = useState(0); const [descriptions, setDescriptions] = useState<string[]>(new Array(languaguesList.length).fill("")); const [availableDays, setAvailableDays] = useState<AvailableDays>(AvailableDays.WEEKEND); const [placeList, setPlaceList] = useState<Place[]>([]); const [isLoading, setIsLoading] = useState(false); const {townsList, getTownsByState} = useTown(); const {getStates, statesList} = useGetStatesList(); const [pending, setPending] = useState(false); useEffect(() => { setIsLoading(true); Loading Loading @@ -201,15 +203,18 @@ export const usePlaceRegister = () => { } } const getPlacesByTown = async (idTown: number) => { const updatePlacesByTown = async (idTown: number) => { setPending(true); try{ const towns = await townRepository.getTownsByState(stateId, stateName); setTownsList(towns); const places = await placeRepository.getPlacesByTown(idTown); setPlaceList(places); setPending(false); }catch(error: any){ if(axios.isAxiosError(error)){ error as AxiosError; showErrorAxios(error); } setPending(false); } } Loading @@ -231,6 +236,9 @@ export const usePlaceRegister = () => { updateTimeForm, availableDays, setAvailableDays, resetField resetField, updatePlacesByTown, placeList, pending }; } Loading
web/src/hooks/usePlaceRegister.tsx→web/src/hooks/usePlace.tsx +13 −5 Original line number Diff line number Diff line Loading @@ -122,7 +122,7 @@ const resolver: Resolver<Place> = async (data) => { }; }; export const usePlaceRegister = () => { export const usePlace = () => { const { register, handleSubmit, Loading @@ -135,9 +135,11 @@ export const usePlaceRegister = () => { const [languageDescriptionIndexSelected, setLanguageDescriptionIndexSelected] = useState(0); const [descriptions, setDescriptions] = useState<string[]>(new Array(languaguesList.length).fill("")); const [availableDays, setAvailableDays] = useState<AvailableDays>(AvailableDays.WEEKEND); const [placeList, setPlaceList] = useState<Place[]>([]); const [isLoading, setIsLoading] = useState(false); const {townsList, getTownsByState} = useTown(); const {getStates, statesList} = useGetStatesList(); const [pending, setPending] = useState(false); useEffect(() => { setIsLoading(true); Loading Loading @@ -201,15 +203,18 @@ export const usePlaceRegister = () => { } } const getPlacesByTown = async (idTown: number) => { const updatePlacesByTown = async (idTown: number) => { setPending(true); try{ const towns = await townRepository.getTownsByState(stateId, stateName); setTownsList(towns); const places = await placeRepository.getPlacesByTown(idTown); setPlaceList(places); setPending(false); }catch(error: any){ if(axios.isAxiosError(error)){ error as AxiosError; showErrorAxios(error); } setPending(false); } } Loading @@ -231,6 +236,9 @@ export const usePlaceRegister = () => { updateTimeForm, availableDays, setAvailableDays, resetField resetField, updatePlacesByTown, placeList, pending }; }