You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I thought it'd nice to introduce Nuxt runtime hooks to hook into the fetch client(s) interceptors.
So instead of having to create a custom client, we can utilize Nuxt hooks. Example:
exportdefaultdefineNuxtPlugin((nuxtApp)=>{// A global interceptornuxtApp.hook('openFetch:onRequest',(ctx)=>{console.log('My logging',ctx.request)})// An interceptor for a particular clientnuxtApp.hook('openFetch:onRequest:myApi',(ctx)=>{console.log('My logging',ctx.request)})})
I've created a draft PR which implement this feature. I haven't tested it thoroughly yet, I aim to do that later this week.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
First of all - thanks for an awesome module!
I thought it'd nice to introduce Nuxt runtime hooks to hook into the fetch client(s) interceptors.
So instead of having to create a custom client, we can utilize Nuxt hooks. Example:
I've created a draft PR which implement this feature. I haven't tested it thoroughly yet, I aim to do that later this week.
Beta Was this translation helpful? Give feedback.
All reactions