Skip to content

Commit

Permalink
fix: opt in to import.meta.* properties (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Mar 25, 2024
1 parent 5d3994d commit 53bb585
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/runtime/composables/useStrapiAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const useStrapiAuth = () => {
const token = useStrapiToken()
const user = useStrapiUser()
const client = useStrapiClient()
const config = process.server ? useRuntimeConfig() : useRuntimeConfig().public
const config = import.meta.server ? useRuntimeConfig() : useRuntimeConfig().public

const setToken = (value: string | null) => {
token.value = value
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/composables/useStrapiGraphQL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useRuntimeConfig } from '#imports'

export const useStrapiGraphQL = () => {
const client = useStrapiClient()
const config = process.server ? useRuntimeConfig() : useRuntimeConfig().public
const config = import.meta.server ? useRuntimeConfig() : useRuntimeConfig().public

return <T> (query: string|DocumentNode, variables?: StrapiGraphqlVariables): Promise<T> => {
const queryAsString = typeof query === 'string' ? query : print(query)
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/composables/useStrapiMedia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { joinURL } from 'ufo'
import { useRuntimeConfig } from '#imports'

export const useStrapiMedia = (path: string): string => {
const config = process.server ? useRuntimeConfig() : useRuntimeConfig().public
const config = import.meta.server ? useRuntimeConfig() : useRuntimeConfig().public

return joinURL(config.strapi.url, path)
}
2 changes: 1 addition & 1 deletion src/runtime/composables/useStrapiToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useCookie, useNuxtApp, useRuntimeConfig } from '#imports'

export const useStrapiToken = () => {
const nuxt = useNuxtApp()
const config = process.server ? useRuntimeConfig() : useRuntimeConfig().public
const config = import.meta.server ? useRuntimeConfig() : useRuntimeConfig().public

nuxt._cookies = nuxt._cookies || {}
if (nuxt._cookies[config.strapi.cookieName]) {
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/composables/useStrapiUrl.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useRuntimeConfig } from '#imports'

export const useStrapiUrl = (): string => {
const config = process.server ? useRuntimeConfig() : useRuntimeConfig().public
const config = import.meta.server ? useRuntimeConfig() : useRuntimeConfig().public

const version = config.strapi.version
return version === 'v3' ? config.strapi.url : `${config.strapi.url}${config.strapi.prefix}`
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/composables/useStrapiVersion.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useRuntimeConfig } from '#imports'

export const useStrapiVersion = (): string => {
const config = process.server ? useRuntimeConfig() : useRuntimeConfig().public
const config = import.meta.server ? useRuntimeConfig() : useRuntimeConfig().public

return config.strapi.version
}

0 comments on commit 53bb585

Please sign in to comment.