0
1
Fork 0

send Accept-Language header

This commit is contained in:
William Buezas 2024-11-28 21:23:02 -03:00
parent c61b047fed
commit 3c3e88b044
1 changed files with 4 additions and 0 deletions

View File

@ -3,6 +3,7 @@ import { Connection } from '../js/db/connection';
import { useUserStore } from 'stores/user';
import axios from 'axios';
import useNotify from 'src/composables/useNotify.js';
import { useAppStore } from 'src/stores/app';
const { notify } = useNotify();
// Be careful when using SSR for cross-request state pollution
@ -37,9 +38,12 @@ const onResponseError = error => {
export default boot(({ app }) => {
const userStore = useUserStore();
const appStore = useAppStore();
console.log('appStore', appStore);
function addToken(config) {
if (userStore.token) {
config.headers.Authorization = userStore.token;
config.headers['Accept-Language'] = appStore.siteLang;
}
return config;
}