From e1a3409090adf1bdd628c5b23790fb3491bf17da Mon Sep 17 00:00:00 2001 From: NataliaCancinoV Date: Sat, 11 May 2024 15:54:21 -0600 Subject: [PATCH] Commit Login con popup --- .../{PopupRegistro => PopupRegistro.jsx} | 5 ++- frontend/src/Popups/PopupRsindatos.jsx | 35 +++++++++++++++++++ frontend/src/Sesion/LoginForm.jsx | 28 +++++++++------ 3 files changed, 54 insertions(+), 14 deletions(-) rename frontend/src/Popups/{PopupRegistro => PopupRegistro.jsx} (94%) create mode 100644 frontend/src/Popups/PopupRsindatos.jsx diff --git a/frontend/src/Popups/PopupRegistro b/frontend/src/Popups/PopupRegistro.jsx similarity index 94% rename from frontend/src/Popups/PopupRegistro rename to frontend/src/Popups/PopupRegistro.jsx index 6b30745..9a83177 100644 --- a/frontend/src/Popups/PopupRegistro +++ b/frontend/src/Popups/PopupRegistro.jsx @@ -2,7 +2,7 @@ import { Button } from "@mui/base" import { Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from "@mui/material" import { useState } from "react" -function Popup (){ +function PopupRegistro (){ const[open,setOpen] = useState(true); @@ -14,7 +14,6 @@ function Popup (){ const eventoCerrar = () => { setOpen(false) } - return( <>
@@ -34,4 +33,4 @@ function Popup (){ ) } -export default Popup \ No newline at end of file +export default PopupRegistro \ No newline at end of file diff --git a/frontend/src/Popups/PopupRsindatos.jsx b/frontend/src/Popups/PopupRsindatos.jsx new file mode 100644 index 0000000..6c53ea4 --- /dev/null +++ b/frontend/src/Popups/PopupRsindatos.jsx @@ -0,0 +1,35 @@ +import { Button } from "@mui/base" +import { Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from "@mui/material" +import { useState } from "react" + +function Popup (){ + const[open,setOpen] = useState(true); + + const eventoAbrir = () => { + setOpen(true) + } + + const eventoCerrar = () => { + setOpen(false) + } + return( + <> + +
+ + Registro Fallido + + + Porfavor introduzca los datos correspondientes. + + + + + + +
+ + ) +} + +export default Popup \ No newline at end of file diff --git a/frontend/src/Sesion/LoginForm.jsx b/frontend/src/Sesion/LoginForm.jsx index 43c37b2..a3b2713 100644 --- a/frontend/src/Sesion/LoginForm.jsx +++ b/frontend/src/Sesion/LoginForm.jsx @@ -3,6 +3,8 @@ import './LoginForm.css'; import { redirect } from 'react-router-dom'; import axios from "axios"; import { useNavigate } from "react-router-dom"; +//import PopupV from "/src/Popups/PopupLoginValido.jsx"; +//import PopupIv from "./Popups/PopupLoginInvalido.jsx"; function LoginForm(props) { const navigate = useNavigate(); @@ -46,7 +48,6 @@ function LoginForm(props) { text: "Usuario o Contraseña Incorrecta.", icon: "error", button: "Aceptar" - }); } @@ -56,14 +57,13 @@ function LoginForm(props) { text: "Introduzca los datos que se le piden.", icon: "error", button: "Aceptar" - }); } const loginUsuario = async (evento) => { evento.preventDefault(); try{ - const response = await axios.post('http://localhost:4567/frontend/login',{datosFormulario}) + const response = await axios.post('http://localhost/Login',{datosFormulario}) console.log(response.data) console.log("c = " +datosFormulario.correo+" p = "+datosFormulario.password) if(datosFormulario.correo && datosFormulario.password){ @@ -84,10 +84,7 @@ const loginUsuario = async (evento) => { //abrirPopupV() } - - - }else{ - + }else{ mostrarAlertaLoginSinDatos(); } @@ -116,6 +113,10 @@ const cambiosFormulario = (evento) => { setMostrarPopupIv(false); } + +const redirectToHome = () => { + navigate("/"); +}; return ( <> @@ -129,16 +130,15 @@ const cambiosFormulario = (evento) => {
Inicia Sesión
- +
- +
- {/**/} - +
@@ -149,6 +149,12 @@ const cambiosFormulario = (evento) => { Olvidaste la contraseña?
+ + {mostrarPopupV && setMostrarPopupV(false)} />} + + + {mostrarPopupIv && setMostrarPopupIv(false)} />} +