ofetch Interceptors (onResponseError etc..) #349
-
Hello 🙂 Does anyone know if it's possible to use interceptors like onRequestError or onResponseError with nuxt-auth-sanctum? Currently, I see support for onRequest and onResponse via defineAppConfig, but I’d like to handle cases like connection refused / no response (e.g., when the API is offline). Thanks in advance! Something like this
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Hey @AntonLugtenburg! Good question 😄 I've recently covered this one via Nuxt hook which you can subscribe to - |
Beta Was this translation helpful? Give feedback.
Hey @AntonLugtenburg! Good question 😄 I've recently covered this one via Nuxt hook which you can subscribe to -
sanctum:error
. Overriding ofetch interceptors is not the best way since it might conflict with an existing behaviour, so it would be better to keep your business logic separated.