From 0b2de88f4a04b3667f203059edf83543b300fa77 Mon Sep 17 00:00:00 2001 From: Jason Zhu Date: Mon, 27 Mar 2023 23:29:10 +1100 Subject: [PATCH] Show loading image when GetRegionListQuery and GetTypeListQuery is loading --- src/features/Pokedex/Pokedex.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/features/Pokedex/Pokedex.tsx b/src/features/Pokedex/Pokedex.tsx index ac36958..ea25254 100644 --- a/src/features/Pokedex/Pokedex.tsx +++ b/src/features/Pokedex/Pokedex.tsx @@ -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 ( <> - {isLoading ? ( + {isLoadingRegionList && isLoadingTypeList ? ( ) : (