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 Pokemon from './Pokemon';
import Filters from './Filters';
import { useGetPokemonListQuery } from './pokedexApi';
import { useGetRegionListQuery, useGetTypeListQuery } from './pokedexApi';
import Loading from 'components/Loading';
import charizard from 'features/Pokedex/Pokemon/assets/stories/charizard.svg';
const Pokedex = () => {
const { data, error, isLoading } = useGetPokemonListQuery();
const { isLoading: isLoadingRegionList } = useGetRegionListQuery();
const { isLoading: isLoadingTypeList } = useGetTypeListQuery();
return (
<>
<Filters />
{isLoading ? (
{isLoadingRegionList && isLoadingTypeList ? (
<Loading />
) : (
<Pokemon