Closed idc77 closed 4 months ago
I have also tried
import { store } from 'quasar/wrappers'
import { createPinia } from 'pinia'
import { createORM } from 'pinia-orm'
import {createPiniaOrmAxios} from "@pinia-orm/axios";
import {manager} from "boot/oidc.js";
import {axiosInstance} from "boot/axios.js";
/*
* If not building with SSR mode, you can
* directly export the Store instantiation;
*
* The function below can be async too; either use
* async/await or return a Promise which resolves
* with the Store instance.
*/
console.log("store")
async function getAuthHeader() {
const user = await manager.getUser()
console.log('user', user)
return {
Authorization: `Bearer ${user?.access_token}`
}
}
export default store( async(/* { ssrContext } */) => {
console.log("instore")
const pinia = createPinia()
const piniaOrm = createORM()
piniaOrm().use(createPiniaOrmAxios({
axios: axiosInstance,
headers: await getAuthHeader()
}))
pinia.use(piniaOrm)
// You can add Pinia plugins here
// pinia.use(SomePiniaPlugin)
return pinia
})
I'm guessing it's not really a Pinia ORM Axios bug, but me not knowing how to solve this.
It only works on HMR, but not otherwise.
Environment
Build Modules: -
"@pinia-orm/axios": "^1.9.1",
Reproduction
idk how to create a "minimal" reproduction of this. Should I create a fresh repo?
Describe the bug
I'm using oidc-client-ts, with quasar. oidc-client-ts is async I tried
import axios from "axios"
but I have now created a boot file boot/axios.jsboot/oidc.js
plugins/vueoidcclient.js
At this point, tokenInterceptor does nothing.
I also have store/index.js
user never gets logged.
With all this, the
Authorization: Bearer <token>
never gets sent. I have already tried async and await, same result.I also have, in the SFC
Nothing. No header gets sent.
Additional context
How do I debug this?
Logs