axiosでトークン取得を修正する
This commit is contained in:
@@ -16,7 +16,7 @@ declare module '@vue/runtime-core' {
|
|||||||
// "export default () => {}" function below (which runs individually
|
// "export default () => {}" function below (which runs individually
|
||||||
// for each client)
|
// for each client)
|
||||||
const api:AxiosInstance = axios.create({ baseURL: process.env.KAB_BACKEND_URL });
|
const api:AxiosInstance = axios.create({ baseURL: process.env.KAB_BACKEND_URL });
|
||||||
const token=JSON.parse(localStorage.getItem('auth') ?? '{}')?.token||'';
|
const token=JSON.parse(localStorage.getItem('auth') ?? '{}')?.token ?? '';
|
||||||
if(token!==''){
|
if(token!==''){
|
||||||
api.defaults.headers["Authorization"]='Bearer ' + token;
|
api.defaults.headers["Authorization"]='Bearer ' + token;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user