From 2317dbfded38e396f89c0782fb9c3dd36b92cbd9 Mon Sep 17 00:00:00 2001 From: TZGyn Date: Mon, 31 Jul 2023 13:55:52 +0800 Subject: [PATCH] Frontend: update fetch referer header --- frontend/composables/fetch.ts | 4 +++- frontend/nuxt.config.ts | 28 +++++++++++++++------------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/frontend/composables/fetch.ts b/frontend/composables/fetch.ts index 9bcfe07..dac519f 100644 --- a/frontend/composables/fetch.ts +++ b/frontend/composables/fetch.ts @@ -6,7 +6,9 @@ const useCustomFetch = async ( path: string, options: UseFetchOptions = {} ) => { - let headers: any = {} + let headers: any = { + referer: config.public.frontend_url, + } const token = useCookie('XSRF-TOKEN') if (token.value) { diff --git a/frontend/nuxt.config.ts b/frontend/nuxt.config.ts index f716190..d3b103f 100644 --- a/frontend/nuxt.config.ts +++ b/frontend/nuxt.config.ts @@ -1,16 +1,18 @@ // https://nuxt.com/docs/api/configuration/nuxt-config export default defineNuxtConfig({ - modules: ['@nuxtjs/tailwindcss', 'nuxt-icon', '@vueuse/nuxt'], - tailwindcss: { - configPath: './tailwind.config.ts', - }, - typescript: { - strict: true, - }, - runtimeConfig: { - public: { - laravelApi: process.env.LARAVEL_API || 'http://localhost:8000', - }, - }, - ssr: false, + modules: ['@nuxtjs/tailwindcss', 'nuxt-icon', '@vueuse/nuxt'], + tailwindcss: { + configPath: './tailwind.config.ts', + }, + typescript: { + strict: true, + }, + runtimeConfig: { + public: { + laravelApi: process.env.LARAVEL_API || 'http://192.168.100.40:8000', + frontend_url: + process.env.frontend_url || 'http://192.168.100.40:3000', + }, + }, + ssr: false, })