File tree Expand file tree Collapse file tree 1 file changed +29
-2
lines changed
Expand file tree Collapse file tree 1 file changed +29
-2
lines changed Original file line number Diff line number Diff line change 11import { useQuery } from "@apollo/client" ;
2- import { Grid , Typography } from "@mui/material" ;
2+ import { CircularProgress , Grid , Typography } from "@mui/material" ;
33
44import { ShopItem } from "@/components/pages/Janus/Shop/ShopItem" ;
55import { Template } from "@/components/pages/Janus/Template" ;
@@ -8,8 +8,35 @@ import { Layout } from "@/layouts/Layout";
88import { NextPageWithLayout } from "@/lib/next" ;
99
1010const ShopPage : NextPageWithLayout = ( ) => {
11- const { data } = useQuery ( ProductsDocument ) ;
11+ const { loading , error , data } = useQuery ( ProductsDocument ) ;
1212
13+ if ( loading ) {
14+ return (
15+ < Template title = "Janus Nettbutikk" description = "" >
16+ < CircularProgress />
17+ </ Template >
18+ ) ;
19+ }
20+ if ( error ) {
21+ return (
22+ < Template title = "Janus Nettbutikk" description = "" >
23+ < Typography variant = "body1" gutterBottom >
24+ Feil ved lasting av produkter. Vennligst prøv igjen senere. Hvis problemet vedvarer, kontakt
25+ 26+ </ Typography >
27+ </ Template >
28+ ) ;
29+ }
30+ if ( data === undefined ) {
31+ return (
32+ < Template title = "Janus Nettbutikk" description = "" >
33+ < Typography variant = "body1" gutterBottom >
34+ Fant ingen produkter. Vennligst sjekk at du er innlogget og prøv igjen. Hvis problemet vedvarer, kontakt
35+ 36+ </ Typography >
37+ </ Template >
38+ ) ;
39+ }
1340 return (
1441 < Template title = "Janus Nettbutikk" description = "" >
1542 < Typography variant = "h3" gutterBottom >
You can’t perform that action at this time.
0 commit comments