From e059363d53f4c5f832a2e715b9ef027a90a947be Mon Sep 17 00:00:00 2001 From: Mariela Date: Tue, 9 Aug 2022 17:04:40 -0600 Subject: [PATCH] =?UTF-8?q?segunda=20forma=20de=20inicio=20de=20sesi=C3=B3?= =?UTF-8?q?n,=20realizad?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/LoginLocalStorage.js | 6 +- web-ui/web-react/src/components/MenuAdmin.js | 57 ++++++++++++------- web-ui/web-react/src/pages/Menu.js | 2 +- web-ui/web-react/src/routes/Routes.js | 2 +- 4 files changed, 42 insertions(+), 25 deletions(-) diff --git a/web-ui/web-react/src/components/LoginLocalStorage.js b/web-ui/web-react/src/components/LoginLocalStorage.js index 5e19537d..2fe0332f 100644 --- a/web-ui/web-react/src/components/LoginLocalStorage.js +++ b/web-ui/web-react/src/components/LoginLocalStorage.js @@ -53,7 +53,7 @@ class LoginLocalStorage extends Component { cookies.set('name', user.name, { path: "/" }); cookies.set('email', user.email, { path: "/" }); alert(`Bienvenido ${user.name}`); - window.location.href = "./"; + window.location.href = "/"; } else { alert('El usuario o la contraseña no son correctos'); } @@ -68,7 +68,7 @@ class LoginLocalStorage extends Component { componentDidMount() { if (cookies.get('email')) { - window.location.href = "./"; + window.location.href = "/"; } } @@ -106,7 +106,7 @@ class LoginLocalStorage extends Component {
{ - cookies.remove('id', { path: "/" }); - cookies.remove('email', { path: "/" }); - cookies.remove('name', { path: "/" }); - window.location.href = '/'; -} - class MenuAdmin extends Component { - state = { - layoutColorMode: 'light', - layoutMode: 'static', + constructor(){ + super() + this.state = { + layoutColorMode: 'light', + layoutMode: 'static', + menuClick: false, + mobileTopbarMenuClick: false, + overlayMenuActive: false, + mobileMenuActive: false + } + + } + + onSidebarClick = () => { + this.setState({ + menuClick: true + }) } + onMenuItemClick = (event) => { + if (!event.item.items) { + this.state.overlayMenuActive = false; + this.state.mobileMenuActive = false; + this.setState({ + overlayMenuActive: true, + mobileMenuActive:false + }) + + } + } cerrarSesion = () => { cookies.remove('id', { path: "/" }); cookies.remove('email', { path: "/" }); cookies.remove('name', { path: "/" }); - window.location.href = '/'; + window.location.href = '/login'; } componentDidMount() { if (!cookies.get('email')) { - window.location.href = "./"; - } + window.location.href = "/login"; + } } render() { @@ -56,8 +73,10 @@ class MenuAdmin extends Component { return (
Menu Principal -
- +
+ + +
@@ -66,12 +85,10 @@ class MenuAdmin extends Component { -

-
); } diff --git a/web-ui/web-react/src/pages/Menu.js b/web-ui/web-react/src/pages/Menu.js index f06ce0ad..88758bdf 100644 --- a/web-ui/web-react/src/pages/Menu.js +++ b/web-ui/web-react/src/pages/Menu.js @@ -13,7 +13,7 @@ class Menu extends Component { componentDidMount() { if(!cookies.get('email')){ - window.location.href="./"; + window.location.href="./login"; } } diff --git a/web-ui/web-react/src/routes/Routes.js b/web-ui/web-react/src/routes/Routes.js index 9af9a965..bebacd7b 100644 --- a/web-ui/web-react/src/routes/Routes.js +++ b/web-ui/web-react/src/routes/Routes.js @@ -11,7 +11,7 @@ function Routes() { - + );