fix: storefront live search relative URLs + auth error messages + TPV clock

- Storefront: use relative URLs in api.ts (fix ERR_ADDRESS_UNREACHABLE)
- Auth: show specific error for EMAIL_NOT_CONFIRMED
- TPV: add clock with date/time, modern SVG icons, panel toggle left
This commit is contained in:
chattie
2026-08-24 16:13:02 +02:00
parent 3d404de25c
commit 30a0cd3552
9 changed files with 163 additions and 21 deletions

View File

@@ -35,6 +35,13 @@ export default function LoginPage() {
{error && (
<div className="bg-red-50 border border-red-200 text-red-700 text-sm rounded-lg px-4 py-3">
{error}
{error.includes('no confirmado') && (
<div className="mt-2">
<Link href="/auth/recuperar" className="underline font-medium hover:no-underline">
Solicitar nuevo enlace de confirmación
</Link>
</div>
)}
</div>
)}
<div>

View File

@@ -65,6 +65,13 @@ export default function RegisterPage() {
{error && (
<div className="bg-red-50 border border-red-200 text-red-700 text-sm rounded-lg px-4 py-3">
{error}
{error.includes('ya está registrado') && (
<div className="mt-2">
<Link href="/auth/login" className="underline font-medium hover:no-underline">
Inicia sesión con tu cuenta existente
</Link>
</div>
)}
</div>
)}
<div>

View File

@@ -43,7 +43,13 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
});
const data = await res.json();
if (!res.ok) {
return { ok: false, error: data.error?.message || 'Error de login' };
if (data.error?.code === 'EMAIL_NOT_CONFIRMED') {
return { ok: false, error: 'Email no confirmado. Revisa tu correo o solicita un nuevo enlace de confirmación.' };
}
if (data.error?.code === 'EMAIL_ALREADY_REGISTERED') {
return { ok: false, error: 'Este email ya está registrado. ¿Ya tienes cuenta? Inicia sesión.' };
}
return { ok: false, error: data.error?.message || 'Email o contraseña incorrectos' };
}
setUser(data);
return { ok: true };
@@ -58,6 +64,9 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
});
const data = await res.json();
if (!res.ok) {
if (data.error?.code === 'EMAIL_ALREADY_REGISTERED') {
return { ok: false, error: 'Este email ya está registrado. ¿Ya tienes cuenta? Inicia sesión.' };
}
return { ok: false, error: data.error?.message || 'Error de registro' };
}
setUser(data);