Fixed setIsLoadingPokemons calling in fetchPokemonsInRegion

develop
Jason Zhu 2023-04-17 19:13:28 +10:00
parent c10c2f2608
commit 3926267d77
1 changed files with 3 additions and 0 deletions

View File

@ -19,6 +19,8 @@ export const fetchPokemonsInTheRegion = createAsyncThunk<
const { dispatch, getState } = thunkAPI; const { dispatch, getState } = thunkAPI;
const regionOptions = getState().pokedex.regionOptions; const regionOptions = getState().pokedex.regionOptions;
dispatch(setIsLoadingPokemons(true));
const { startId, endId } = getStartAndEndIdsForRegion(region, regionOptions); const { startId, endId } = getStartAndEndIdsForRegion(region, regionOptions);
const pokemonIds = Array.from( const pokemonIds = Array.from(
{ length: endId - startId + 1 }, { length: endId - startId + 1 },
@ -114,6 +116,7 @@ export const {
setRegionOptions, setRegionOptions,
setTypeOptions, setTypeOptions,
setSortOptions, setSortOptions,
setIsLoadingPokemons,
} = pokedexSlice.actions; } = pokedexSlice.actions;
export default pokedexSlice.reducer; export default pokedexSlice.reducer;