Fixed token retrieval

This commit is contained in:
Antoine Nguyen
2024-06-22 19:44:53 +02:00
committed by Spitfireap
parent 73cf7ba2ae
commit 65bf649af8
+3 -2
View File
@@ -6,11 +6,12 @@ import { useAuthStore } from '@/stores'
const _axios = axios.create()
_axios.interceptors.request.use(
function (config) {
async function (config) {
const authStore = useAuthStore()
if (authStore.isAuthenticated) {
const token = await authStore.getAccessToken()
config.headers['Accept-Language'] = authStore.authUser.language
config.headers['Authorization'] = `Bearer ${authStore.getAccessToken()}`
config.headers['Authorization'] = `Bearer ${token}`
}
return config
},