Fix login: don't intercept 401 on auth/login itself

A failed login attempt was triggering the global 401 interceptor which
silently redirected back to /login, making the form appear broken.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mattias Tall
2026-05-26 10:40:33 +02:00
parent fb2e42051e
commit a33491fee0

View File

@@ -11,7 +11,7 @@ api.interceptors.request.use((config) => {
api.interceptors.response.use( api.interceptors.response.use(
(res) => res, (res) => res,
(err) => { (err) => {
if (err.response?.status === 401) { if (err.response?.status === 401 && !err.config?.url?.includes("/auth/login")) {
localStorage.removeItem("token"); localStorage.removeItem("token");
window.location.href = "/login"; window.location.href = "/login";
} }