axiosでトークン取得を修正する

This commit is contained in:
Mouriya
2024-08-08 15:48:09 +09:00
parent 914b0d85df
commit 4a4a9d72e6

View File

@@ -16,7 +16,7 @@ declare module '@vue/runtime-core' {
// "export default () => {}" function below (which runs individually
// for each client)
const api:AxiosInstance = axios.create({ baseURL: process.env.KAB_BACKEND_URL });
const token=localStorage.getItem('token')||'';
const token=JSON.parse(localStorage.getItem('auth') ?? '{}')?.token||'';
if(token!==''){
api.defaults.headers["Authorization"]='Bearer ' + token;
}