From f81d742bde40acaa7483f646ea3038fd9d8d54ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81?= Date: Fri, 16 Jan 2026 20:59:01 +0100 Subject: [PATCH] Revert "Refactor login method to use unified identifier for user input; update request body to support both email and username" This reverts commit 3c901a35a6365db15228b9976fd9c54017af67f6. --- src/services/auth.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/services/auth.js b/src/services/auth.js index 6368b0a..8260d07 100644 --- a/src/services/auth.js +++ b/src/services/auth.js @@ -4,19 +4,14 @@ export class Auth { this.isAuthenticated = false; } - async login(identifier, password) { - if (!identifier || !password) return false; + async login(email, password) { + if (!email || !password) return false; try { const response = await fetch(`${import.meta.env.VITE_API_BASE_URL}/api/Auth/login`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, - // Enviamos ambos nombres de campo para cubrir email o userName segĂșn espere el backend. - body: JSON.stringify({ - email: identifier, - userName: identifier, - password - }) + body: JSON.stringify({ email, password }) }); if (!response.ok) return false; @@ -24,7 +19,7 @@ export class Auth { const { token, user } = await response.json(); if (!token) return false; - this.currentUser = user || { email: identifier }; + this.currentUser = user || { email }; this.isAuthenticated = true; localStorage.setItem('user', JSON.stringify(this.currentUser)); localStorage.setItem('token', token);