-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
* feat: allow factory function for customClient * docs: wording * chore: use runWithContext
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,14 +6,16 @@ import NuxtLink from '#app/components/nuxt-link' | |
import { defineNuxtPlugin, useCookie, useRequestEvent, onNuxtReady, refreshNuxtData, useHead, useRuntimeConfig, useRouter } from '#imports' | ||
|
||
// @ts-expect-error vfs cannot be resolved here | ||
import client from '#build/prismic/proxy/client' | ||
import _client from '#build/prismic/proxy/client' | ||
// @ts-expect-error vfs cannot be resolved here | ||
import linkResolver from '#build/prismic/proxy/linkResolver' | ||
// @ts-expect-error vfs cannot be resolved here | ||
import richTextSerializer from '#build/prismic/proxy/richTextSerializer' | ||
|
||
export default defineNuxtPlugin((nuxtApp) => { | ||
export default defineNuxtPlugin(async (nuxtApp) => { | ||
Check failure on line 15 in src/runtime/plugin.ts GitHub Actions / test (os ubuntu-latest, node 18)
Check failure on line 15 in src/runtime/plugin.ts GitHub Actions / test (os ubuntu-latest, node 20)
Check failure on line 15 in src/runtime/plugin.ts GitHub Actions / test (os ubuntu-latest, node lts/*)
Check failure on line 15 in src/runtime/plugin.ts GitHub Actions / test (os windows-latest, node 18)
Check failure on line 15 in src/runtime/plugin.ts GitHub Actions / test (os windows-latest, node 20)
Check failure on line 15 in src/runtime/plugin.ts GitHub Actions / test (os windows-latest, node lts/*)
Check failure on line 15 in src/runtime/plugin.ts GitHub Actions / test (os macos-latest, node 18)
Check failure on line 15 in src/runtime/plugin.ts GitHub Actions / test (os macos-latest, node 20)
Check failure on line 15 in src/runtime/plugin.ts GitHub Actions / test (os macos-latest, node lts/*)
|
||
const options: PrismicModuleOptions = useRuntimeConfig().public.prismic | ||
const client = typeof _client === 'function' ? await nuxtApp.runWithContext(() => _client()) : _client | ||
|
||
const endpoint = options.environment || options.endpoint || (client as Client | undefined)?.endpoint || '' | ||
|
||
const prismicPlugin = createPrismic({ | ||
|