24 lines
623 B
TypeScript
24 lines
623 B
TypeScript
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) {
|
|
if (axios.isAxiosError(error)) {
|
|
return {
|
|
error: error.response?.data?.message || "Error al consultar equipo",
|
|
};
|
|
}
|
|
|
|
return { error: "Error desconocido" };
|
|
}
|
|
} |