From ab7033c2a4221d476cd36ff12d91bebddb1ae860 Mon Sep 17 00:00:00 2001 From: Marsel Shaikhin Date: Thu, 12 Dec 2024 17:53:30 +0100 Subject: [PATCH] fix(#927): fix minor nuxt warning --- src/runtime/utils/fetch.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/runtime/utils/fetch.ts b/src/runtime/utils/fetch.ts index f1eb8902..c4594c08 100644 --- a/src/runtime/utils/fetch.ts +++ b/src/runtime/utils/fetch.ts @@ -4,7 +4,10 @@ import { callWithNuxt, useRuntimeConfig } from '#app' import type { useNuxtApp } from '#imports' export async function _fetch(nuxt: ReturnType, path: string, fetchOptions?: Parameters[1]): Promise { - const runtimeConfig = await callWithNuxt(nuxt, useRuntimeConfig) + // This fixes https://github.com/sidebase/nuxt-auth/issues/927 + const runtimeConfigOrPromise = callWithNuxt(nuxt, useRuntimeConfig) + const runtimeConfig = 'public' in runtimeConfigOrPromise ? runtimeConfigOrPromise : await runtimeConfigOrPromise + const joinedPath = resolveApiUrlPath(path, runtimeConfig) // Prevent callback recursion when doing internal routing