added new headers and added table in asignation table

This commit is contained in:
2026-02-27 11:27:52 -06:00
parent 0ddb17a23f
commit 1027bd0673
26 changed files with 240 additions and 105 deletions
@@ -6,13 +6,10 @@ import Toggle from "@/app/Components/Global/Toggle/Toggle";
export default async function Page(props: {
searchParams?: Promise<{
key?: string;
numAcount?: string;
machine?: string;
}>;
}) {
const params = await props.searchParams;
const key = params?.key && params.key;
const numAcount = params?.numAcount ? params.numAcount : null;
return (
<section className="containerSection">
+1
View File
@@ -8,6 +8,7 @@ import axios from "axios";
import { envConfig } from "@/app/lib/config";
import Cookies from "js-cookie";
import Swal from "sweetalert2";
import "./addTime.css";
const PLATAFORMA_MAP: Record<string, number> = {
@@ -6,9 +6,11 @@ import { envConfig } from "@/app/lib/config";
import { getEquipoByCount } from "@/app/lib/getEquipoByCount";
import { getMesaByCount } from "@/app/lib/getMesaByCount";
import "./asignacion.css";
import Swal from "sweetalert2";
import axios from "axios";
import Cookies from "js-cookie";
import "./asignacion.css";
type Props = {
inscripcion: any[];
@@ -72,10 +74,14 @@ export default function PlaticaGate({ inscripcion, numAcount }: Props) {
const fetchEquipos = async () => {
try {
const token = Cookies.get("token");
const headers = { Authorization: `Bearer ${token}` };
setLoadingEquipos(true);
const res = await axios.get(
`${envConfig.apiUrl}/equipo/student/${numAcount}`
`${envConfig.apiUrl}/equipo/student/${numAcount}`,
{ headers },
);
setEquipos(res.data);
+41 -35
View File
@@ -7,12 +7,13 @@ import Toggle from "@/app/Components/Global/Toggle/Toggle";
import { GetRegisterStudent } from "@/app/lib/getRegisterStudent";
import { GetRegisterStudentSancion } from "@/app/lib/GetRegisterStudentSancion";
import TableTable from "../Monitor/TableTable";
export default async function Page(props: {
searchParams?: Promise<{
key?: string;
numAcount?: string;
table?:number
table?: number
}>;
}) {
const params = await props.searchParams;
@@ -39,7 +40,7 @@ export default async function Page(props: {
? Boolean(rawPlatica.data[0])
: Boolean(rawPlatica);
}
const inscResult = await GetRegisterStudent(idCuenta);
if (!inscResult.error && Array.isArray(inscResult)) {
@@ -55,41 +56,46 @@ export default async function Page(props: {
<h2 className="title"> ASIGNACIÓN DE MESAS </h2>
<Toggle
defaultView={key}
options={[
{
key: "Asignar",
label: "Asignar mesa",
content: (
<>
<SearchUser value={numAcount} />
<div style={{ display: 'flex' }}>
<Toggle
defaultView={key}
options={[
{
key: "Asignar",
label: "Asignar mesa",
content: (
<>
<SearchUser value={numAcount} />
{student && (
<>
<div>
<Information
NoCuenta={student.id_cuenta}
nombre={student.nombre}
{student && (
<>
<div>
<Information
NoCuenta={student.id_cuenta}
nombre={student.nombre}
/>
</div>
<AsignacionMesas
idCuenta={student.id_cuenta}
inscripcion={inscripcion}
/>
</div>
<AsignacionMesas
idCuenta={student.id_cuenta}
inscripcion={inscripcion}
/>
</>
)}
</>
),
},
{
key: "Liberar",
label: "Cancelar mesa",
content: <CheckBoxMesa numAcount={numAcount} table={table} />,
},
]}
/>
</>
)}
</>
),
},
{
key: "Liberar",
label: "Cancelar mesa",
content: <CheckBoxMesa numAcount={numAcount} table={table} />,
},
]}
/>
<div style={{ margin: "0 1rem", width: "100%" }}>
<TableTable />
</div>
</div>
</section>
);
}
@@ -15,6 +15,7 @@
.form-container {
gap: 10px;
margin-bottom: 1rem;
}
.form-container label {
+6 -1
View File
@@ -3,6 +3,7 @@
import { useEffect, useState } from "react";
import styles from "./Page.module.css";
import axios from "axios";
import Cookies from "js-cookie";
type AreaUbicacion = {
id_area_ubicacion: number;
@@ -26,8 +27,12 @@ export default function MachineTable() {
const fetchMachines = async () => {
try {
const token = Cookies.get("token");
const headers = { Authorization: `Bearer ${token}` };
const res = await axios.get(
`${process.env.NEXT_PUBLIC_API_URL}/equipo/disable`
`${process.env.NEXT_PUBLIC_API_URL}/equipo/disable`,
{ headers },
);
setMachines(res.data);
+10 -2
View File
@@ -3,6 +3,7 @@
import { useEffect, useState } from "react";
import styles from "./Page.module.css";
import axios from "axios";
import Cookies from "js-cookie";
type AreaUbicacion = {
id_area_ubicacion: number;
@@ -24,10 +25,15 @@ export default function MachineTableActive() {
const [selectedArea, setSelectedArea] = useState("Todo");
const [loading, setLoading] = useState(true);
const token = Cookies.get("token");
const headers = { Authorization: `Bearer ${token}` };
const fetchMachines = async () => {
try {
const res = await axios.get(
`${process.env.NEXT_PUBLIC_API_URL}/equipo/active`
`${process.env.NEXT_PUBLIC_API_URL}/equipo/active`,
{ headers },
);
setMachines(res.data);
@@ -41,7 +47,9 @@ export default function MachineTableActive() {
const fetchAreas = async () => {
try {
const res = await axios.get(
`${process.env.NEXT_PUBLIC_API_URL}/area-ubicacion`
`${process.env.NEXT_PUBLIC_API_URL}/area-ubicacion`,
{ headers },
);
setAreas(res.data);
+6 -1
View File
@@ -3,6 +3,7 @@
import { useEffect, useState } from "react";
import styles from "./Page.module.css";
import axios from "axios";
import Cookies from "js-cookie";
type Mesa = {
id_mesa: number;
@@ -13,10 +14,14 @@ export default function TableTable() {
const [mesas, setMesas] = useState<Mesa[]>([]);
const [loading, setLoading] = useState(true);
const token = Cookies.get("token");
const headers = { Authorization: `Bearer ${token}` };
const fetchMesas = async () => {
try {
const res = await axios.get(
`${process.env.NEXT_PUBLIC_API_URL}/mesa/uso`
`${process.env.NEXT_PUBLIC_API_URL}/mesa/uso`,
{ headers },
);
setMesas(res.data);
+1 -1
View File
@@ -11,7 +11,7 @@ export default async function Page(props: {
}) {
const params = await props.searchParams;
const numAcount = params?.numAcount ?? null;
const key = params?.key ?? "active";
const key = params?.key ?? "Equipos";
return (
<section className="containerSection">
+11 -4
View File
@@ -1,10 +1,11 @@
"use client";
import { useState, useEffect } from "react";
import styleprograms from "./programas.module.css";
import { envConfig } from "@/app/lib/config";
import styleprograms from "./programas.module.css";
import axios from "axios";
import Swal from "sweetalert2";
import Cookies from "js-cookie";
interface Programa {
id_programa: number;
@@ -17,6 +18,9 @@ export default function Page() {
const [programas, setProgramas] = useState<Programa[]>([]);
const [nombrePrograma, setNombrePrograma] = useState("");
const token = Cookies.get("token");
const headers = { Authorization: `Bearer ${token}` };
const cargarProgramas = async () => {
try {
const response = await axios.get(`${envConfig.apiUrl}/programa/`);
@@ -63,13 +67,14 @@ export default function Page() {
const handleGuardar = async () => {
if (!programaSeleccionado) return;
try {
await axios.patch(
`${envConfig.apiUrl}/programa/${programaSeleccionado}`,
{
programa: nombrePrograma,
}
},
{ headers },
);
await cargarProgramas();
@@ -107,7 +112,9 @@ export default function Page() {
try {
await axios.delete(
`${envConfig.apiUrl}/programa/${programaSeleccionado}`
`${envConfig.apiUrl}/programa/${programaSeleccionado}`,
{ headers },
);
await cargarProgramas();
@@ -1,8 +1,9 @@
"use client";
import { envConfig } from "@/app/lib/config";
import axios from "axios";
import { useEffect, useState } from "react";
import axios from "axios";
import Cookies from "js-cookie";
export default function Equipos() {
const [cuenta, setCuenta] = useState("");
@@ -13,7 +14,12 @@ export default function Equipos() {
useEffect(() => {
const fetchEquipos = async () => {
try {
const response = await axios.get(`${envConfig.apiUrl}/equipo`);
const token = Cookies.get("token");
const headers = { Authorization: `Bearer ${token}` };
const response = await axios.get(`${envConfig.apiUrl}/equipo`,
{ headers },
);
setEquipos(response.data);
} catch (error: any) {
setMensaje(
@@ -1,9 +1,10 @@
"use client";
import { useEffect, useState } from "react";
import axios from "axios";
import { envConfig } from "@/app/lib/config";
import axios from "axios";
import Swal from "sweetalert2";
import Cookies from "js-cookie";
interface Mesa {
id_mesa: number;
@@ -14,6 +15,9 @@ export default function MesasDisponibles() {
const [mesas, setMesas] = useState<Mesa[]>();
const [loading, setLoading] = useState(true);
const token = Cookies.get("token");
const headers = { Authorization: `Bearer ${token}` };
useEffect(() => {
obtenerMesas();
}, []);
@@ -31,8 +35,10 @@ export default function MesasDisponibles() {
const toggleEquipo = async (id_mesa: number) => {
try {
await axios.patch(
`${envConfig.apiUrl}/mesa/${id_mesa}/activo`
`${envConfig.apiUrl}/mesa/${id_mesa}/activo`,
{ headers },
);
setMesas((prev) =>
+16 -12
View File
@@ -6,6 +6,8 @@ import { getEquipoByCount } from "../lib/getEquipoByCount";
import { getMesaByCount } from "../lib/getMesaByCount";
import Swal from "sweetalert2";
import axios from "axios";
import Cookies from "js-cookie";
import { useRouter } from "next/navigation";
type Props = {
inscripcion: any[];
@@ -21,6 +23,8 @@ export default function AsignacionMesas({ idCuenta, inscripcion }: Props) {
const [bitacora, setBitacora] = useState<[] | null>([]);
const [error, setError] = useState<string>();
const router = useRouter();
const fetchByCuenta = async (idCuenta: number) => {
const [result, resultMesa] = await Promise.all([
getEquipoByCount(idCuenta),
@@ -33,19 +37,11 @@ export default function AsignacionMesas({ idCuenta, inscripcion }: Props) {
setBitacora([]);
if (!result?.error) {
setError("Equio")
Swal.fire({
title: "Ya cuentas con un equipo asignado!",
icon: "error",
});
setError("Equipo")
}
if (!resultMesa?.error) {
setError("Mesa")
Swal.fire({
title: "Ya cuentas con mesa asignada!",
icon: "error",
});
}
}
};
@@ -80,10 +76,14 @@ export default function AsignacionMesas({ idCuenta, inscripcion }: Props) {
const fetchMesas = async () => {
try {
const token = Cookies.get("token");
const headers = { Authorization: `Bearer ${token}` };
setLoadingMesas(true);
const response = await axios.get(
`${envConfig.apiUrl}/mesa/activo`
`${envConfig.apiUrl}/mesa/activo`,
{ headers },
);
setMesas(response.data);
@@ -113,6 +113,9 @@ export default function AsignacionMesas({ idCuenta, inscripcion }: Props) {
}
try {
const token = Cookies.get("token");
const headers = { Authorization: `Bearer ${token}` };
const body = {
tiempo_asignado: tiempo,
id_mesa: Number(mesaSeleccionada),
@@ -121,11 +124,12 @@ export default function AsignacionMesas({ idCuenta, inscripcion }: Props) {
await axios.post(
`${envConfig.apiUrl}/bitacora-mesa`,
body
body,
{ headers },
);
setBitacora([]);
router.refresh();
Swal.fire({
title: "Mesa asignada correctamente!",
icon: "success",
@@ -1,11 +1,12 @@
"use client";
import SearchDate from "../SearchDate/SearchDate";
import { useEffect, useState } from "react";
import { envConfig } from "@/app/lib/config";
import SearchDate from "../SearchDate/SearchDate";
import axios from "axios";
import Cookies from "js-cookie";
import "../../(private)/AsignacionEquipo/asignacion.css"
import { envConfig } from "@/app/lib/config";
import axios from "axios";
interface equipos {
hora_entrada: string;
min_utilizados: number;
@@ -21,9 +22,13 @@ export default function BitacoraEquipo({ date }: { date: string | null }) {
const [equipos, setEquipos] = useState<any[]>([]);
useEffect(() => {
const token = Cookies.get("token");
const headers = { Authorization: `Bearer ${token}` };
const fetchData = async () => {
setLoadingEquipos(true);
const response = await axios.get(`${envConfig.apiUrl}/equipo`);
const response = await axios.get(`${envConfig.apiUrl}/equipo`, { headers },
);
setEquipos(response.data);
setLoadingEquipos(false);
};
+7 -1
View File
@@ -1,18 +1,24 @@
"use client";
import { useEffect, useState } from "react";
import { envConfig } from "../lib/config";
import { getEquipoByCount } from "../lib/getEquipoByCount";
import SearchUser from "./Global/SearchUser/searchUser";
import SearchEquipo from "./SearchEquipo";
import axios from "axios";
import Information from "./Global/Information/information";
import Swal from "sweetalert2";
import Cookies from "js-cookie";
async function getEquipoId(idEquipo: number) {
try {
const token = Cookies.get("token");
const headers = { Authorization: `Bearer ${token}` };
const res = await axios.get(
`${envConfig.apiUrl}/bitacora/equipo/${idEquipo}`,
{ headers },
);
return res.data;
} catch (error: any) {
+10
View File
@@ -4,11 +4,14 @@ import { useEffect, useState } from "react";
import { getTableByCount } from "../lib/getTableByCount";
import { envConfig } from "../lib/config";
import { getMesaByCount } from "../lib/getMesaByCount";
import { useRouter } from "next/navigation";
import SearchUser from "./Global/SearchUser/searchUser";
import Information from "./Global/Information/information";
import SearchMesa from "./SearchMesa";
import axios from "axios";
import Swal from "sweetalert2";
import Cookies from "js-cookie";
interface props {
numAcount: string | null;
@@ -23,6 +26,8 @@ export default function CheckBoxMesa({ numAcount, table }: props) {
const [error, setError] = useState()
const [loading, setLoading] = useState<boolean>(false)
const router = useRouter();
const fetchByCuenta = async (idCuenta: number) => {
const result = await getMesaByCount(idCuenta);
@@ -89,9 +94,13 @@ export default function CheckBoxMesa({ numAcount, table }: props) {
e.preventDefault();
setLoading(false)
const token = Cookies.get("token");
const headers = { Authorization: `Bearer ${token}` };
await axios.patch(
`${envConfig.apiUrl}/bitacora-mesa/cancelar/${bitacora.id_bitacora_mesa}`,
{ tiempo_asignado: minutos },
{ headers },
);
Swal.fire({
@@ -107,6 +116,7 @@ export default function CheckBoxMesa({ numAcount, table }: props) {
if (modo === "Mesa" && table) {
fetchByEquipo(table);
}
router.refresh();
setLoading(true)
};
+19 -11
View File
@@ -1,8 +1,9 @@
"use client";
import axios from "axios";
import { envConfig } from "@/app/lib/config";
import { useState } from "react";
import Swal from "sweetalert2";
import axios from "axios";
import Cookies from "js-cookie";
interface Data {
nombre_equipo: string;
@@ -44,11 +45,17 @@ export default function Equipos() {
e.preventDefault();
try {
const token = Cookies.get("token");
const headers = { Authorization: `Bearer ${token}` };
const [equipoRes, plataformaRes, areaRes] = await Promise.all([
axios.get(`${envConfig.apiUrl}/equipo/${id}`),
axios.get(`${envConfig.apiUrl}/alumno-inscrito/plataforma`),
axios.get(`${envConfig.apiUrl}/area-ubicacion`),
axios.get(`${envConfig.apiUrl}/equipo/${id}`, { headers },
),
axios.get(`${envConfig.apiUrl}/alumno-inscrito/plataforma`, { headers },
),
axios.get(`${envConfig.apiUrl}/area-ubicacion`, { headers },
),
]);
const equipo = equipoRes.data as Data;
@@ -277,13 +284,14 @@ export default function Equipos() {
</div>
</div>
)}
<button
type="button"
className="button buttonCharge"
onClick={handleNuevo}
>
Nuevo
</button>
<button
type="button"
className="button buttonCharge"
onClick={handleNuevo}
>
Nuevo
</button>
</form>
);
}
//IO
+14 -4
View File
@@ -3,17 +3,25 @@
import { envConfig } from "@/app/lib/config";
import { useEffect, useState } from "react";
import "./tableEquipos.css";
import axios from "axios";
import Cookies from "js-cookie";
import "./tableEquipos.css";
export default function TableEquipos() {
const [equipos, setEquipos] = useState<any[]>([]);
const [loading, setLoading] = useState(true);
const token = Cookies.get("token");
const headers = { Authorization: `Bearer ${token}` };
useEffect(() => {
const fetchEquipos = async () => {
try {
const response = await axios.get(`${envConfig.apiUrl}/equipo`);
const response = await axios.get(`${envConfig.apiUrl}/equipo`,
{ headers },
);
setEquipos(response.data);
} catch (error: any) {
console.error("ERROR API:", error.response?.data || error.message);
@@ -28,7 +36,8 @@ export default function TableEquipos() {
const toggleEquipo = async (id_equipo: number) => {
try {
await axios.patch(
`${envConfig.apiUrl}/equipo/${id_equipo}/activo`
`${envConfig.apiUrl}/equipo/${id_equipo}/activo`,
{ headers },
);
setEquipos((prev) =>
@@ -84,7 +93,7 @@ export default function TableEquipos() {
<td className={eq.plataforma?.nombre}>
{eq.plataforma?.nombre}
</td>
<td>{eq.areaUbicacion?.nombre || eq.id_area_ubicacion}</td>
<td>{eq.areaUbicacion?.area || eq.id_area_ubicacion}</td>
<td
style={{ display: "flex", alignItems: "center", gap: "5px" }}
@@ -105,3 +114,4 @@ export default function TableEquipos() {
</div>
);
}
//IO
@@ -3,6 +3,7 @@ import { envConfig } from "@/app/lib/config";
import axios from "axios";
import { useEffect, useState } from "react";
import Swal from "sweetalert2";
import Cookies from "js-cookie";
interface Programa {
id_programa: number;
@@ -19,11 +20,14 @@ export default function ProgramSelector({
const [programas, setProgramas] = useState<Programa[]>([]);
const [checkboxes, setCheckboxes] = useState<Record<number, boolean>>({});
const token = Cookies.get("token");
const headers = { Authorization: `Bearer ${token}` };
useEffect(() => {
const fetchData = async () => {
const [programasRes] = await Promise.all([
axios.get(`${envConfig.apiUrl}/programa`),
]);
axios.get(`${envConfig.apiUrl}/programa`, { headers },
)]);
setProgramas(programasRes.data);
@@ -58,9 +62,10 @@ export default function ProgramSelector({
{
programas: programasSeleccionados,
},
{ headers },
);
Swal.fire({
title: "Programas actualizados en la máquina!",
icon: "success",
@@ -70,12 +75,15 @@ export default function ProgramSelector({
}
if (id) {
await axios.patch(`${envConfig.apiUrl}/programa-equipo/sala`, {
sala: id,
programas: programasSeleccionados,
});
await axios.patch(`${envConfig.apiUrl}/programa-equipo/sala`,
{
sala: id,
programas: programasSeleccionados,
},
{ headers },
);
Swal.fire({
title: "Programas actualizados en la sala",
icon: "success",
@@ -90,7 +98,7 @@ export default function ProgramSelector({
draggable: true
});
} catch (error) {
Swal.fire({
title: "Error al guardar cambios!",
@@ -116,12 +124,15 @@ export default function ProgramSelector({
if (ubicacion && ubicacion !== "0") {
res = await axios.get(
`${envConfig.apiUrl}/programa-equipo/${ubicacion}`,
{ headers },
);
}
if (id) {
res = await axios.get(
`${envConfig.apiUrl}/area-ubicacion/programs/${id}`,
{ headers },
);
}
@@ -131,14 +142,14 @@ export default function ProgramSelector({
} catch (error: any) {
if (axios.isAxiosError(error)) {
if (error.response?.status === 404) {
Swal.fire({
title: "Sin programas asignados!",
icon: "error",
draggable: true
});
} else {
Swal.fire({
title: "Error al cargar programas!",
icon: "error",
@@ -147,7 +158,7 @@ export default function ProgramSelector({
}
} else {
Swal.fire({
title: "Error inesperado!",
icon: "error",
@@ -1,8 +1,10 @@
"use client";
import { envConfig } from "@/app/lib/config";
import { usePathname, useRouter, useSearchParams } from "next/navigation";
import { useEffect, useState } from "react";
import axios from "axios";
import Cookies from "js-cookie";
import "../../(private)/AsignacionEquipo/asignacion.css";
@@ -33,10 +35,15 @@ export default function SelectorEquipo({ onSearch }: Props) {
const [loadingEquipos, setLoadingEquipos] = useState(false);
const [open, setOpen] = useState(false);
const token = Cookies.get("token");
const headers = { Authorization: `Bearer ${token}` };
useEffect(() => {
const fetchData = async () => {
setLoadingEquipos(true);
const response = await axios.get(`${envConfig.apiUrl}/equipo`);
const response = await axios.get(`${envConfig.apiUrl}/equipo`, { headers },
);
setEquipos(response.data);
setLoadingEquipos(false);
};
@@ -85,7 +92,7 @@ export default function SelectorEquipo({ onSearch }: Props) {
</div>
{open && (
<div className="options" style={{ bottom: "auto"}}>
<div className="options" style={{ bottom: "auto" }}>
{equipos.length === 0 && (
<div className="option disabled">
No hay equipos disponibles
@@ -3,6 +3,7 @@ import { envConfig } from "@/app/lib/config";
import { useEffect, useState } from "react";
import { usePathname, useRouter, useSearchParams } from "next/navigation";
import axios from "axios";
import Cookies from "js-cookie";
interface Area {
id_area_ubicacion: number;
@@ -45,8 +46,13 @@ export default function SelectorSala({ onSearch }: Props) {
};
useEffect(() => {
const token = Cookies.get("token");
const headers = { Authorization: `Bearer ${token}` };
const fetchData = async () => {
const response = await axios.get(`${envConfig.apiUrl}/area-ubicacion`);
const response = await axios.get(`${envConfig.apiUrl}/area-ubicacion`, { headers },
);
setSala(response.data);
};
+8 -3
View File
@@ -1,14 +1,14 @@
"use client";
import { useState } from "react";
import { useRouter } from "next/navigation";
import { usePathname, useRouter, useSearchParams } from "next/navigation";
import { envConfig } from "@/app/lib/config";
import Selection from "../Selection/Selection";
import Cookies from "js-cookie";
import axios from "axios";
import Swal from "sweetalert2";
import "./Receipt.css";
interface ReceiptsProps {
@@ -32,6 +32,8 @@ export default function Inscripcion({
>(null);
const router = useRouter();
const pathname = usePathname();
const searchParams = useSearchParams();
const [folio, setFolio] = useState("");
const [amount, setAmount] = useState("");
@@ -128,7 +130,10 @@ export default function Inscripcion({
setAmount("");
setDate(todayISO);
router.refresh();
const params = new URLSearchParams(searchParams.toString());
params.delete("numAcount");
router.push(`${pathname}?${params.toString()}`);
} catch (error: any) {
const msg =
error.response?.data?.message ||
+1 -1
View File
@@ -26,7 +26,7 @@ export default function SearchMesa() {
<div className="groupInput">
<input
type="number"
type="text"
placeholder="Coloca el numero de mesa"
value={inputValue}
onChange={(e) => setInputValue(e.target.value)}
+5
View File
@@ -1,10 +1,15 @@
import axios from "axios";
import { envConfig } from "./config";
import Cookies from "js-cookie";
export async function getEquipoByCount(idCuenta: number) {
try {
const token = Cookies.get("token");
const headers = { Authorization: `Bearer ${token}` };
const res = await axios.get(
`${envConfig.apiUrl}/bitacora/cuenta/${idCuenta}`,
{ headers },
);
return res.data;
} catch (error: any) {
+5
View File
@@ -1,10 +1,15 @@
import axios from "axios";
import { envConfig } from "./config";
import Cookies from "js-cookie";
export async function getMesaByCount(idCuenta: number) {
try {
const token = Cookies.get("token");
const headers = { Authorization: `Bearer ${token}` };
const res = await axios.get(
`${envConfig.apiUrl}/bitacora-mesa/cuenta/${idCuenta}`,
{ headers },
);
return res.data;
} catch (error: any) {
+5
View File
@@ -1,10 +1,15 @@
import axios from "axios";
import { envConfig } from "./config";
import Cookies from "js-cookie";
export async function getTableByCount(idCuenta: number) {
try {
const token = Cookies.get("token");
const headers = { Authorization: `Bearer ${token}` };
const res = await axios.get(
`${envConfig.apiUrl}/bitacora-mesa/table/${idCuenta}`,
{ headers },
);
return res.data;
} catch (error: any) {