From b7aa2fa66b024282af375c3fa8004c4dd3a4ecb8 Mon Sep 17 00:00:00 2001 From: IO <320154041@pcpuma.acatlan.unam.mx> Date: Wed, 25 Feb 2026 19:27:04 -0600 Subject: [PATCH] tring to put token --- app/(private)/Impresiones/page.tsx | 35 +++++++++++++++++----- app/Components/Global/Toggle/Toggle.tsx | 12 ++++++-- app/Components/Impressions/impressions.tsx | 7 +++-- app/lib/apiClient.ts | 1 - app/lib/getCost.ts | 28 +++++++++++++++++ 5 files changed, 71 insertions(+), 12 deletions(-) create mode 100644 app/lib/getCost.ts diff --git a/app/(private)/Impresiones/page.tsx b/app/(private)/Impresiones/page.tsx index 7bbb6de..585faf0 100644 --- a/app/(private)/Impresiones/page.tsx +++ b/app/(private)/Impresiones/page.tsx @@ -6,10 +6,8 @@ import Impressions from "@/app/Components/Impressions/impressions"; import ShowError from "@/app/Components/Global/ShowError"; import { cookies } from "next/headers"; +import { getCost } from "@/app/lib/getCost"; import { GetStudentWhitoutSancion } from "@/app/lib/getStudentWhitoutSancion"; -import { envConfig } from "@/app/lib/config"; - -import axios from "axios"; import "@/app/globals.css"; @@ -40,9 +38,32 @@ export default async function Page(props: { } } + let id_servicio: number; + + switch (key) { + case "B/N": + id_servicio = 1; + break; + + case "color": + id_servicio = 2; + break; + + case "Plotter": + id_servicio = 3; + break; + + case "Escaner": + id_servicio = 6; + break; + } + try { - const response = await axios.get(`${envConfig.apiUrl}/costo`); - costos = response.data; + console.log(`getCost`) + + const response = await getCost(); + costos = response; + } catch (error) { console.error("Error obteniendo costos:", error); } @@ -119,8 +140,8 @@ export default async function Page(props: { const optionsToUse = roleNumber === 5 ? options.filter( - (option) => option.key === "Recibo" || option.key === "B/N" - ) + (option) => option.key === "Recibo" || option.key === "B/N" + ) : options; return ( diff --git a/app/Components/Global/Toggle/Toggle.tsx b/app/Components/Global/Toggle/Toggle.tsx index 8183867..9684064 100644 --- a/app/Components/Global/Toggle/Toggle.tsx +++ b/app/Components/Global/Toggle/Toggle.tsx @@ -7,7 +7,7 @@ import { useState, ReactNode } from "react"; interface ToggleOption { key: string; label: string; - content: ReactNode; + content: ReactNode | (() => ReactNode); } interface ToggleProps { @@ -46,7 +46,15 @@ export default function Toggle({ options, defaultView }: ToggleProps) {