mirror of
https://github.com/mosh-hamedani/game-hub.git
synced 2026-05-21 12:14:32 +02:00
Show a spinner while fetching the genres
This commit is contained in:
parent
7d6f205614
commit
f2bb5d8381
|
|
@ -1,9 +1,13 @@
|
||||||
import { HStack, Image, List, ListItem, Text } from "@chakra-ui/react";
|
import { HStack, Image, List, ListItem, Spinner, Text } from "@chakra-ui/react";
|
||||||
import useGenres from "../hooks/useGenres";
|
import useGenres from "../hooks/useGenres";
|
||||||
import getCroppedImageUrl from "../services/image-url";
|
import getCroppedImageUrl from "../services/image-url";
|
||||||
|
|
||||||
const GenreList = () => {
|
const GenreList = () => {
|
||||||
const { data } = useGenres();
|
const { data, isLoading, error } = useGenres();
|
||||||
|
|
||||||
|
if (error) return null;
|
||||||
|
|
||||||
|
if (isLoading) return <Spinner />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<List>
|
<List>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue