Skip to content

Commit

Permalink
fix: opt-in to import.meta.* based on #252
Browse files Browse the repository at this point in the history
  • Loading branch information
sandros94 committed Mar 25, 2024
1 parent aeafc47 commit 8030e51
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
extends: [process.env.NUXT_UI_PRO_PATH || '@nuxt/ui-pro'],
extends: [import.meta.env.NUXT_UI_PRO_PATH || '@nuxt/ui-pro'],
modules: [
'@nuxt/content',
'@nuxt/image',
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/composables/use-directus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ export const useDirectus = <T extends object = any>(options?: DirectusClientOpti
globals: {
fetch: $fetch.create({
onRequestError: ({ request, options, error }) => {
if (process.dev) {
if (import.meta.dev) {
console.error('Request error:', request, options, error)
}
},
onResponseError: ({ request, options, response, error }) => {
if (process.dev) {
if (import.meta.dev) {
console.error('Response error:', request, options, response, error)
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/runtime/plugins/auto-refresh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {

const event = nuxtApp?.ssrContext?.event

if (process.server && event) {
if (import.meta.server && event) {
if (useNuxtCookies) {
const refreshToken = getCookie(event, refreshTokenCookieName)

Expand Down Expand Up @@ -67,7 +67,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
}
}
}
} else if (process.client && (!tokens.value?.access_token || !user.value)) {
} else if (import.meta.client && (!tokens.value?.access_token || !user.value)) {
nuxtApp.hook('app:mounted', async () => { await refresh().catch(_e => null) })
}

Expand All @@ -76,7 +76,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
const restricted = (!toArray.length || !!toArray.find((p: string) => p === to.path))

if (!user.value && to.path !== redirectTo && restricted) {
if (process.client && !nuxtApp.isHydrating) {
if (import.meta.client && !nuxtApp.isHydrating) {
return abortNavigation()
} else {
return navigateTo(redirectTo)
Expand Down

0 comments on commit 8030e51

Please sign in to comment.