init auth

This commit is contained in:
xds
2026-02-08 17:36:22 +03:00
parent 7732856f90
commit 6856449075
11 changed files with 473 additions and 68 deletions

View File

@@ -10,6 +10,19 @@ const api = axios.create({
})
// Request interceptor handling can be added here if needed
api.interceptors.request.use(
config => {
const user = JSON.parse(localStorage.getItem('user'));
if (user && user.token) {
config.headers['Authorization'] = `${user.tokenType} ${user.token}`;
}
return config;
},
error => {
return Promise.reject(error);
}
);
api.interceptors.response.use(
response => response,
error => {