Show loading image when GetRegionListQuery and GetTypeListQuery is loading

develop
Jason Zhu 2023-03-27 23:29:10 +11:00
parent 9eb1f1f971
commit 0b2de88f4a
1 changed files with 4 additions and 3 deletions

View File

@ -1,18 +1,19 @@
import React from 'react'; import React from 'react';
import Pokemon from './Pokemon'; import Pokemon from './Pokemon';
import Filters from './Filters'; import Filters from './Filters';
import { useGetPokemonListQuery } from './pokedexApi'; import { useGetRegionListQuery, useGetTypeListQuery } from './pokedexApi';
import Loading from 'components/Loading'; import Loading from 'components/Loading';
import charizard from 'features/Pokedex/Pokemon/assets/stories/charizard.svg'; import charizard from 'features/Pokedex/Pokemon/assets/stories/charizard.svg';
const Pokedex = () => { const Pokedex = () => {
const { data, error, isLoading } = useGetPokemonListQuery(); const { isLoading: isLoadingRegionList } = useGetRegionListQuery();
const { isLoading: isLoadingTypeList } = useGetTypeListQuery();
return ( return (
<> <>
<Filters /> <Filters />
{isLoading ? ( {isLoadingRegionList && isLoadingTypeList ? (
<Loading /> <Loading />
) : ( ) : (
<Pokemon <Pokemon