From 5ca821d0bc81509ca30abb73031c1b8734b27d30 Mon Sep 17 00:00:00 2001
From: IO420 <320154041@pcpuma.acatlan.unam.mx>
Date: Wed, 10 Sep 2025 21:00:00 -0400
Subject: [PATCH] add login funccions
---
app/AsignacionEquipo/page.tsx | 1 -
app/BitacoraSanciones/page.tsx | 2 --
app/Components/Login/Login.tsx | 33 +++++++++----------
.../ProgramSelector/ProgramSelector.tsx | 33 +++++++++----------
app/lib/config.ts | 3 ++
app/lib/login.ts | 15 +++++++++
6 files changed, 49 insertions(+), 38 deletions(-)
create mode 100644 app/lib/config.ts
create mode 100644 app/lib/login.ts
diff --git a/app/AsignacionEquipo/page.tsx b/app/AsignacionEquipo/page.tsx
index 2e1cb1d..a717075 100644
--- a/app/AsignacionEquipo/page.tsx
+++ b/app/AsignacionEquipo/page.tsx
@@ -34,7 +34,6 @@ export default function Page() {
content: (
<>
- {" "}
diff --git a/app/BitacoraSanciones/page.tsx b/app/BitacoraSanciones/page.tsx
index f6e4285..ea1605e 100644
--- a/app/BitacoraSanciones/page.tsx
+++ b/app/BitacoraSanciones/page.tsx
@@ -176,7 +176,6 @@ export default function Page() {
- {" "}
);
diff --git a/app/Components/ProgramSelector/ProgramSelector.tsx b/app/Components/ProgramSelector/ProgramSelector.tsx
index 6b6ea84..c3b034d 100644
--- a/app/Components/ProgramSelector/ProgramSelector.tsx
+++ b/app/Components/ProgramSelector/ProgramSelector.tsx
@@ -49,59 +49,58 @@ function ProgramSelector({ titulo, opcion }: DatosEquipo) {
{" "}
+
{" "}
+
{" "}
+
{" "}
+
{" "}
+
{" "}
+
{" "}
+
{" "}
+
{" "}
+
{" "}
+
{" "}
+
{" "}
+
{" "}
+
{" "}
+
{" "}
+
{" "}
+
- {/* ... resto de checkboxes */}
diff --git a/app/lib/config.ts b/app/lib/config.ts
new file mode 100644
index 0000000..8e4f59b
--- /dev/null
+++ b/app/lib/config.ts
@@ -0,0 +1,3 @@
+export const envConfig = {
+ apiUrl: process.env.NEXT_PUBLIC_API_URL,
+};
diff --git a/app/lib/login.ts b/app/lib/login.ts
new file mode 100644
index 0000000..680a445
--- /dev/null
+++ b/app/lib/login.ts
@@ -0,0 +1,15 @@
+import axios from "axios";
+import { envConfig } from "./config";
+
+export async function loginUser(usuario: string, password: string) {
+ try {
+ const response = await axios.post(`${envConfig.apiUrl}/user`, { usuario, password });
+ return response.data;
+ } catch (error: any) {
+ const msg =
+ error.response?.data?.message ||
+ error.message ||
+ "Error desconocido en el login";
+ return { error: msg };
+ }
+}