Skip to content

Commit

Permalink
Merge branch 'version/2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
demtario committed Mar 19, 2024
2 parents d523ef8 + b01ab79 commit 55b606c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "store",
"version": "2.2.0",
"version": "2.2.1",
"private": true,
"scripts": {
"start": "nuxt start",
Expand Down
5 changes: 3 additions & 2 deletions plugins/axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ declare module 'axios' {
const cacheStorage = buildMemoryStorage()

export default defineNuxtPlugin((nuxt) => {
const { apiUrl: baseURL, isProduction, axiosCacheTtl } = usePublicRuntimeConfig()
const { apiUrl: baseURL, production, axiosCacheTtl } = usePublicRuntimeConfig()
const isProduction = computed(() => ['true', '1', 1, true].includes(production))
const axiosCacheTtlTime = parseInt(axiosCacheTtl || '0') ?? 0
const localePath = useLocalePath()

Expand Down Expand Up @@ -113,7 +114,7 @@ export default defineNuxtPlugin((nuxt) => {
ax.interceptors.response.use((response) => {
const config = response.config
config._endTime = Date.now()
if (!isProduction) {
if (!isProduction.value) {
const time = response.cached ? 'cache' : `${config._endTime - config._beginTime!}ms`
// eslint-disable-next-line no-console
console.log(`(${time}) - [${config.method}] ${config.url}`)
Expand Down
5 changes: 3 additions & 2 deletions plugins/vue-gtag.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ import { mapCartItemToItem, mapOrderProductToItem, mapProductToItem } from '@/ut
import { useChannelsStore } from '@/store/channels'

export default defineNuxtPlugin((nuxtApp) => {
const { googleTagManagerId, isProduction, i18n } = usePublicRuntimeConfig()
const { googleTagManagerId, production, i18n } = usePublicRuntimeConfig()
const isProduction = computed(() => ['true', '1', 1, true].includes(production))
if (!googleTagManagerId) return

nuxtApp.vueApp.use(
createGtm({
id: googleTagManagerId,
defer: true,
debug: !isProduction,
debug: !isProduction.value,
vueRouter: useRouter(),
loadScript: true,
enabled: false,
Expand Down
3 changes: 2 additions & 1 deletion server/routes/robots.txt.get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ Disallow: /
export default defineEventHandler((event) => {
// @ts-ignore Docs suggest to pass event to useRuntimeConfig, but it's not typed? https://nuxt.com/docs/guide/going-further/runtime-config#server-routes
const config = useRuntimeConfig(event)
const isProduction = computed(() => ['true', '1', 1, true].includes(config.public.production))

setHeader(event, 'Content-Type', 'text/plain; charset=utf-8')

return config.public.isProduction ? ALLOWED : DISALLOWED
return isProduction.value ? ALLOWED : DISALLOWED
})

0 comments on commit 55b606c

Please sign in to comment.