I want to get the JWT that is inside the session and add it to the headers of the requests that I send to the API, but I can't use useAuthSession in the Axios configuration file
axiosApi.interceptors.request.use(config => {
config.headers["Accept"] = "application/json"
config.headers["X-Client"] = "Qwik"
return config
})
I get this error when I use UseAuthSession
Error: Code(20): Calling a 'use*()' method outside 'component$(() => { HERE })' is not allowed. 'use*()' methods provide hooks to the 'component$' state and lifecycle, ie 'use' hooks can only be called synchronously within the 'component$' function or another 'use' method.
I understand the reason for this error, but is there any way I can get the session?