diff --git a/app/(private)/ActivosMantenimiento/page.tsx b/app/(private)/ActivosMantenimiento/page.tsx index fab5685..8517154 100644 --- a/app/(private)/ActivosMantenimiento/page.tsx +++ b/app/(private)/ActivosMantenimiento/page.tsx @@ -11,7 +11,6 @@ export default function Page() { EQUIPOS ACTIVOS Y EN MANTENIMIENTO - - ); } diff --git a/app/(private)/AsignacionEquipo/asignacionEquipos..css b/app/(private)/AsignacionEquipo/asignacionEquipos..css index dcd6a6c..e73c9f3 100644 --- a/app/(private)/AsignacionEquipo/asignacionEquipos..css +++ b/app/(private)/AsignacionEquipo/asignacionEquipos..css @@ -1,10 +1,3 @@ -/* Add these new styles to your CSS file */ -.mainContainer { - display: flex; - justify-content: space-between; - gap: 20px; /* Adjust the spacing as needed */ - flex-wrap: wrap; /* Allows components to wrap on smaller screens */ -} .availableTablesContainer { /* You can add specific styles for the table list here */ diff --git a/app/(private)/AsignacionEquipo/page.tsx b/app/(private)/AsignacionEquipo/page.tsx index c206a1f..e0280d3 100644 --- a/app/(private)/AsignacionEquipo/page.tsx +++ b/app/(private)/AsignacionEquipo/page.tsx @@ -12,8 +12,6 @@ export default function Page() { ASIGNACION DE EQUIPOS - - {/* Toggle component for 'Asignar' and 'Liberar' tabs */} - - ); } diff --git a/app/(private)/AsignacionMesas/asignacionmesas.css b/app/(private)/AsignacionMesas/asignacionmesas.css index dcd6a6c..e73c9f3 100644 --- a/app/(private)/AsignacionMesas/asignacionmesas.css +++ b/app/(private)/AsignacionMesas/asignacionmesas.css @@ -1,10 +1,3 @@ -/* Add these new styles to your CSS file */ -.mainContainer { - display: flex; - justify-content: space-between; - gap: 20px; /* Adjust the spacing as needed */ - flex-wrap: wrap; /* Allows components to wrap on smaller screens */ -} .availableTablesContainer { /* You can add specific styles for the table list here */ diff --git a/app/(private)/AsignacionMesas/page.tsx b/app/(private)/AsignacionMesas/page.tsx index 1315ccc..e6120f3 100644 --- a/app/(private)/AsignacionMesas/page.tsx +++ b/app/(private)/AsignacionMesas/page.tsx @@ -12,8 +12,6 @@ export default function Page() { ASIGNACION DE MESAS - - {/* Toggle component for 'Asignar' and 'Liberar' tabs */} - - {/* This is the new component to display available tables */} - ); } diff --git a/app/Components/Login/Login.tsx b/app/Components/Login/Login.tsx index f714e06..6cf63fc 100644 --- a/app/Components/Login/Login.tsx +++ b/app/Components/Login/Login.tsx @@ -1,80 +1,82 @@ -'use client'; +"use client"; import { useState } from "react"; import { loginUser } from "@/app/lib/login"; +import { useRouter } from "next/navigation"; import "./Login.css"; function Login() { - const [user, setUser] = useState(""); - const [password, setPassword] = useState(""); - const [message, setMessage] = useState(""); + const [user, setUser] = useState(""); + const [password, setPassword] = useState(""); + const [message, setMessage] = useState(""); - const handleLogin = async (e: React.FormEvent) => { - e.preventDefault(); + const router = useRouter(); - const data = await loginUser(user, password); + const handleLogin = async (e: React.FormEvent) => { + e.preventDefault(); - if ("error" in data) { - setMessage(data.error); - } else { - localStorage.setItem("token", data.access_token); - setMessage("Inicio de sesión exitoso"); - console.log("Respuesta del servidor:", data); - } - }; + const data = await loginUser(user, password); - return ( - + if ("error" in data) { + setMessage(data.error); + } else { + document.cookie = `token=${data.access_token}; path=/; SameSite=Strict`; + setMessage("Inicio de sesión exitoso"); + router.push("/Impresiones"); + } + }; - - Inicio de sesión + return ( + + + Inicio de sesión - - Usuario - setUser(e.target.value)} - placeholder='Coloca tu usuario...' - /> - + + Usuario + setUser(e.target.value)} + placeholder="Coloca tu usuario..." + /> + - - Contraseña - setPassword(e.target.value)} - placeholder='Coloca tu contraseña...' - /> - setShowPassword(!showPassword)} - //className={showPassword ? 'eyeOpen' : 'eyeClose'} - /> - + + Contraseña + setPassword(e.target.value)} + placeholder="Coloca tu contraseña..." + /> + setShowPassword(!showPassword)} + //className={showPassword ? 'eyeOpen' : 'eyeClose'} + /> + - Iniciar sesión - + + Iniciar sesión + - {message && - - {message} - - } - - - ); + {message && ( + + {message} + + )} + + + ); } export default Login; -//IO \ No newline at end of file +//IO diff --git a/app/layout.tsx b/app/layout.tsx index a4cab5d..2d12ac2 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -16,7 +16,7 @@ export const metadata: Metadata = { title: "Servicio AT", description: "Servicio de administracion de la FES Acatlan", authors: [{ name: "FES Acatlán" }], - creator: "Lino,Axel,Carlos", + creator: "Lino,Carlos,Axel", }; export default function RootLayout({ diff --git a/app/middleware.ts b/app/middleware.ts deleted file mode 100644 index 13f1eaa..0000000 --- a/app/middleware.ts +++ /dev/null @@ -1,15 +0,0 @@ - -import { NextResponse } from 'next/server'; -import type { NextRequest } from 'next/server'; - -export function middleware(request: NextRequest) { - const token = request.cookies.get('token'); - - if (!token) { - console.log('No hay token, redirigiendo a la página de inicio de sesión'); - return NextResponse.redirect(new URL('/', request.url)); - } - - return NextResponse.next(); -} -//IO \ No newline at end of file diff --git a/middleware.ts b/middleware.ts new file mode 100644 index 0000000..4f554d5 --- /dev/null +++ b/middleware.ts @@ -0,0 +1,34 @@ +import { NextResponse } from "next/server"; +import type { NextRequest } from "next/server"; + +export function middleware(request: NextRequest) { + const token = request.cookies.get("token"); + + if (!token) { + console.log("No hay token, redirigiendo a la página de inicio de sesión"); + return NextResponse.redirect(new URL("/", request.url)); + } + + return NextResponse.next(); +} + +export const config = { + matcher: [ + "/Reportes", + "/Monitor", + "/QuitarSancion", + "/Programas", + "/Mensajes", + "/Inscritos", + "/Inscripciones", + "/InformacionEquipo", + "/Impresiones", + "/CambiarPass", + "/BitacoraSanciones", + "/AsignacionMesas", + "/AsignacionEquipo", + "/Alta", + "/AgregarTiempo", + "/ActivosMantenimiento"], +}; +//IO