Added setTypeOptions in useEffect()
parent
1801e43192
commit
968c6c5d95
|
@ -7,6 +7,7 @@ import {
|
|||
fetchPokemonsInTheRegion,
|
||||
setRegionOptions,
|
||||
setSortOptions,
|
||||
setTypeOptions,
|
||||
} from 'features/Pokedex/pokedexSlice';
|
||||
import { RegionPokemonRange } from 'features/Pokedex/types/slice';
|
||||
import { useAppDispatch, useAppSelector } from 'app/hooks';
|
||||
|
@ -69,6 +70,10 @@ const Filters = () => {
|
|||
dispatch(setRegionOptions(fetchedRegionOptions));
|
||||
dispatch(setSortOptions(fetchedSortOptions));
|
||||
|
||||
if (!isFetchingTypeOptions && fetchedTypeOptions) {
|
||||
dispatch(setTypeOptions(fetchedTypeOptions.results));
|
||||
}
|
||||
|
||||
dispatch(setSelectedRegion(fetchedRegionOptions[0].region));
|
||||
dispatch(fetchPokemonsInTheRegion(fetchedRegionOptions[0].region));
|
||||
}, []);
|
||||
|
|
Loading…
Reference in New Issue