Agregar axio a login
This commit is contained in:
@@ -50,16 +50,7 @@ export default function Dashboard() {
|
||||
router.push(`/Editar?equipoId=${encontrado.id}`);
|
||||
} else {
|
||||
// 🚫 Si no existe, se puede registrar
|
||||
<<<<<<< HEAD:src/app/Escaner/page.tsx
|
||||
const marca = prompt("Equipo no registrado. Ingresa la marca:");
|
||||
if (marca) {
|
||||
const nuevoEquipo = { id: code, marca, estado: "Desactivado" };
|
||||
setEquipos([...equipos, nuevoEquipo]);
|
||||
alert("Equipo agregado al inventario");
|
||||
}
|
||||
=======
|
||||
router.push(`/AgregarEquipo`);
|
||||
>>>>>>> 374ce02350db05430bc40286bdff9fe767e82eae:src/app/(Operador)/Escaner/page.tsx
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -5,15 +5,27 @@ import "../app/styles/layout/login.scss";
|
||||
import "../app/styles/base/globales.scss";
|
||||
import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
import axios from "axios";
|
||||
|
||||
export default function Login() {
|
||||
const [email, setEmail] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
const [error, setError] = useState("");
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
||||
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
// Autenticacion simulada
|
||||
setError("");
|
||||
setLoading(true);
|
||||
|
||||
try{
|
||||
const response = await axios.post('/api/login', { email, password });
|
||||
} catch (err) {
|
||||
console.error("Error en la solicitud:", err);
|
||||
setError("Error al conectar con el servidor");
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user