middleware/redirect.global.js
My project is in Nuxt3. I create a middleware in order to redirect when a user go to a specific route. And the redirect url is from an APi call. My problem is that API call become twice and i have this error on terminal
[unhandledRejection] Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
[unhandledRejection] Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client