debug: add console logging to token save and request interceptor

- Log when saveToken is called with token details
- Log when request interceptor checks for token
- Log when Authorization header is set or token is missing
- Helps diagnose 401 Unauthorized issues after login
This commit is contained in:
Daniel Bedeleanu
2026-04-11 15:11:25 +03:00
parent c1b8d2d8b9
commit d6e7a8d2a4
2 changed files with 11 additions and 0 deletions

View File

@@ -27,8 +27,12 @@ const axiosInstance = axios.create({
axiosInstance.interceptors.request.use((config) => {
const token = getToken();
console.log('[API] Request interceptor - token exists:', !!token, 'URL:', config.url);
if (token) {
config.headers.Authorization = `Bearer ${token}`;
console.log('[API] Authorization header set');
} else {
console.warn('[API] No token found in localStorage');
}
return config;
}, (error) => Promise.reject(error));