From 0ee70f45134ee8ef2e3cc81659d02384b370a65f Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Mon, 16 Dec 2024 11:25:58 +0100 Subject: [PATCH] Transport the dark mode state to the login theme --- src/oidc.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/oidc.ts b/src/oidc.ts index 45788e9..31404c5 100644 --- a/src/oidc.ts +++ b/src/oidc.ts @@ -1,6 +1,7 @@ import { createReactOidc } from "oidc-spa/react"; import { createMockReactOidc } from "oidc-spa/mock/react"; import { z } from "zod"; +import { getIsDark } from "@codegouvfr/react-dsfr/useIsDark"; const decodedIdTokenSchema = z.object({ sub: z.string(), @@ -15,7 +16,10 @@ export const { OidcProvider, useOidc, getOidc } = issuerUri issuerUri, clientId, publicUrl: import.meta.env.BASE_URL, - decodedIdTokenSchema: decodedIdTokenSchema + decodedIdTokenSchema: decodedIdTokenSchema, + extraQueryParams: () => ({ + dark: getIsDark() ? "true" : "false" + }) //doEnableDebugLogs: true }) : createMockReactOidc({