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:
@@ -11,7 +11,7 @@ api.interceptors.request.use((config) => {
|
||||
api.interceptors.response.use(
|
||||
(res) => res,
|
||||
(err) => {
|
||||
if (err.response?.status === 401) {
|
||||
if (err.response?.status === 401 && !err.config?.url?.includes("/auth/login")) {
|
||||
localStorage.removeItem("token");
|
||||
window.location.href = "/login";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user