submissions

This commit is contained in:
Виталий Лавшонок
2025-11-02 23:41:23 +03:00
parent 235b2c16bd
commit f6c681c038
26 changed files with 589 additions and 298 deletions

View File

@@ -7,4 +7,18 @@ const instance = axios.create({
},
});
// Request interceptor: автоматически подставляет JWT, если есть
instance.interceptors.request.use(
(config) => {
const token = localStorage.getItem("jwt"); // или можно брать из Redux через store.getState()
if (token) {
config.headers.Authorization = `Bearer ${token}`;
}
return config;
},
(error) => {
return Promise.reject(error);
}
);
export default instance;