Closed dtobi59 closed 1 year ago
Hey guys, I am trying to add a custom header on every request going out from my nuxt app.
what I have done:
` export default defineNuxtPlugin(nuxtApp => {
console.log("Coimging frorm Plugin") $http.setHeader("HTTP-REQUEST-SOURCE", 'web:1.0')
}) `
The code works but at the initial load of the dashboard page, it does not work. I then observed that nuxt-alt/auth is making a request to the user profile API before the ohfetch.ts plugin loads.
Please help, how do i overcome this?
Solved by adding below code to nuxt.config.ts
http:{ credentials: 'include', headers: { accept: 'application/json, text/plain, */*', "custom-header-here": 'value', }, }
Hey guys, I am trying to add a custom header on every request going out from my nuxt app.
what I have done:
` export default defineNuxtPlugin(nuxtApp => {
}) `
The code works but at the initial load of the dashboard page, it does not work. I then observed that nuxt-alt/auth is making a request to the user profile API before the ohfetch.ts plugin loads.
Please help, how do i overcome this?