Show loading image when GetRegionListQuery and GetTypeListQuery is loading
parent
9eb1f1f971
commit
0b2de88f4a
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue