aboutsummaryrefslogtreecommitdiff
path: root/playground/src/App.svelte
blob: 350f9562b94c84a6c80ea4e1dde84b661212e971 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<script lang="ts">
  /*** IMPORT ------------------------------------------- ***/

  import { createHttpFetcher, lightTheme } from "../../source/library/index.ts";
  import GraphiQL from "../../source/library/GraphiQL.svelte";

  /*** UTILITY ------------------------------------------ ***/

  const fetcher = createHttpFetcher({
    url: "https://graphql.pokeapi.co/v1beta2"
  });

  const initialQuery = `
    query best_grass_poison_pokemons {
      pokemon: pokemon(
        where: {_and: [{pokemontypes: {type: {name: {_eq: "grass"}}}}, {pokemontypes: {type: {name: {_eq: "poison"}}}}]}
        order_by: {pokemonstats_aggregate: {sum: {base_stat: desc}}}
        limit: 3
      ) {
        name
        stats: pokemonstats_aggregate(order_by: {}) {
          aggregate {
            sum {
              base_stat
            }
          }
        }
      }
    }
  `;
</script>

<GraphiQL {fetcher} {initialQuery} theme={lightTheme}/>