From 2c86905c915f6e21e412787d4c4b6e20be103551 Mon Sep 17 00:00:00 2001 From: Pascal Martineau Date: Wed, 28 Jan 2026 21:09:37 -0500 Subject: [PATCH] fix: use public wpUrl runtime config for auth refresh token mutation --- wp-content/themes/moonshine/nuxt.config.ts | 4 ++++ wp-content/themes/moonshine/server/utils/auth.ts | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-content/themes/moonshine/nuxt.config.ts b/wp-content/themes/moonshine/nuxt.config.ts index 80506be..438e887 100644 --- a/wp-content/themes/moonshine/nuxt.config.ts +++ b/wp-content/themes/moonshine/nuxt.config.ts @@ -40,6 +40,10 @@ export default defineNuxtConfig({ colorMode: false, }, + runtimeConfig: { + wpUrl, + }, + compatibilityDate: "2026-01-01", nitro: { diff --git a/wp-content/themes/moonshine/server/utils/auth.ts b/wp-content/themes/moonshine/server/utils/auth.ts index 2fb66ca..a6aef8e 100644 --- a/wp-content/themes/moonshine/server/utils/auth.ts +++ b/wp-content/themes/moonshine/server/utils/auth.ts @@ -42,8 +42,8 @@ function getAuthUser(user: AuthUserFragment): User { // Refresh auth token by calling remote GraphQL endpoint directly export async function refreshAuthToken(refreshToken: string): Promise { - // TODO: const { public: { graphql: { endpoint } } } = useRuntimeConfig(); - const endpoint = `${process.env.NUXT_WP_URL || "https://cultureat.ledevsimple.ca"}/graphql`; + const { public: { wpUrl } } = useRuntimeConfig(); + const endpoint = `${wpUrl}/graphql`; const { data } = await executeGraphQLHTTP>({ query: AuthRefreshTokenDocument, variables: { refreshToken },