diff --git a/README.md b/README.md index 5ce676612ebf910f459f7d5e3e4b2847d0c1bfbb..243302f2cf88ccf8a820a752b43a8269a26ef2ec 100644 --- a/README.md +++ b/README.md @@ -36,3 +36,22 @@ npm run build You can preview the production build with `npm run preview`. > To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. + +```graphql +mutation createToken { + createToken( + token: { + id: "quiestce" + description: "Qui est-ce | photos & pseudos" + claims: [ + { claim: "users.id", access: READ } + { claim: "users.nickname", access: READ } + { claim: "users.photo", access: READ } + ] + allowedIps: ["0.0.0.0/0"] + } + ) { + base64 + } +} +``` diff --git a/src/lib/graphql/queries.ts b/src/lib/graphql/queries.ts index 105febf37c9e8837a5f611017984f41a249379a9..68a07b47b0c2dde9c34c009e34b5e512bc733517 100644 --- a/src/lib/graphql/queries.ts +++ b/src/lib/graphql/queries.ts @@ -36,3 +36,11 @@ export const USER_DETAILS_QUERY = graphql(` } } `); + +export const INTE_QUERY = graphql(` + query Inte { + globalsValues { + integration + } + } +`); diff --git a/src/routes/quiz/new/+page.server.ts b/src/routes/quiz/new/+page.server.ts index dcb8a7742ab86b83f588ad838a21f35a48af67d6..4ceb1dcde7b0d7bfeafebc396085ac05f080c037 100644 --- a/src/routes/quiz/new/+page.server.ts +++ b/src/routes/quiz/new/+page.server.ts @@ -6,6 +6,9 @@ import { Game, GameStage } from "$lib/game"; import { getPromotion } from "$lib/data"; import images from "./images"; import { sum } from "$lib/utils"; +import { client } from "$lib/graphql"; +import { INTE_QUERY } from "$lib/graphql/queries"; +import { handleGqlError } from "$lib/graphql/error"; type BaseLevel = { year: number; @@ -28,10 +31,16 @@ export async function load(event) { if (game.state.stage !== GameStage.NEW) redirect(303, "/quiz"); + const globals = await client.query(INTE_QUERY, {}); + handleGqlError(globals); + + const { integration } = globals.data!.globalsValues; + const zeroA = integration ? 0 : 1; + const baseLevels: BaseLevel[] = [ { - year: 1, - name: "1A", + year: zeroA, + name: `${zeroA}A`, image: images.stroller, }, {