working and builded
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
XAxis,
|
||||
YAxis
|
||||
} from "recharts";
|
||||
import Cookies from "js-cookie";
|
||||
|
||||
type AdscripcionOption = {
|
||||
id_adscripcion: string
|
||||
@@ -27,18 +28,22 @@ interface AntiguedadData {
|
||||
antiguedad: string
|
||||
total: number
|
||||
}
|
||||
const api_url = process.env.NEXT_PUBLIC_API_URL;
|
||||
|
||||
export default function Antiguedad({ filtros }: Props) {
|
||||
|
||||
const [data, setData] = useState<AntiguedadData[]>([])
|
||||
|
||||
useEffect(() => {
|
||||
const token = Cookies.get("token");
|
||||
const headers = { Authorization: `Bearer ${token}` };
|
||||
|
||||
const getAntiguedad = async () => {
|
||||
|
||||
const response = await axios.post(
|
||||
"http://localhost:3001/equipos/grafica/antiguedad",
|
||||
filtros
|
||||
`${api_url}/equipos/grafica/antiguedad`,
|
||||
filtros,
|
||||
{ headers }
|
||||
)
|
||||
|
||||
setData(response.data)
|
||||
|
||||
@@ -10,6 +10,9 @@ import Procesador from "./Graficas/Procesador"
|
||||
import SistemaOperativo from "./Graficas/SistemaOperativo"
|
||||
import Uso from "./Graficas/Uso"
|
||||
|
||||
import Cookies from "js-cookie";
|
||||
const api_url = process.env.NEXT_PUBLIC_API_URL;
|
||||
|
||||
type AdscripcionOption = {
|
||||
id_adscripcion: string
|
||||
adscripcion: string
|
||||
@@ -51,23 +54,22 @@ export default function Reporte() {
|
||||
const [antiguedad, setAntiguedad] = useState<AntiguedadOption[]>([{ antiguedad: "Menor a 2 años" }, { antiguedad: "Entre 2 y 3 años" }, { antiguedad: "Entre 4 y 5 años" }, { antiguedad: "Mayor a 6 años" }])
|
||||
const [antiguedadSeleccionada, setAntiguedadSeleccionada] = useState<AntiguedadOption[]>([])
|
||||
|
||||
const [antiguedadActiva, setAntiguedadActiva] = useState(false)
|
||||
|
||||
const [filtros, setFiltros] = useState<any>(null)
|
||||
useEffect(() => {
|
||||
|
||||
const cargarDatos = async () => {
|
||||
|
||||
const token = Cookies.get("token");
|
||||
const headers = { Authorization: `Bearer ${token}` };
|
||||
const [
|
||||
adscripcionRes,
|
||||
procesadorRes,
|
||||
usoRes,
|
||||
soRes,
|
||||
] = await Promise.all([
|
||||
axios.get("http://localhost:3001/equipos/adscripciones"),
|
||||
axios.get("http://localhost:3001/equipos/procesador-tipo-equipos"),
|
||||
axios.get("http://localhost:3001/equipos/usos"),
|
||||
axios.get("http://localhost:3001/equipos/sistemas-operativos"),
|
||||
axios.get(`${api_url}/equipos/adscripciones`,{ headers }),
|
||||
axios.get(`${api_url}/equipos/procesador-tipo-equipos`,{ headers }),
|
||||
axios.get(`${api_url}/equipos/usos`,{ headers }),
|
||||
axios.get(`${api_url}/equipos/sistemas-operativos`,{ headers }),
|
||||
])
|
||||
|
||||
setAdscripciones(adscripcionRes.data)
|
||||
|
||||
@@ -35,6 +35,15 @@ export function proxy(request: NextRequest) {
|
||||
|
||||
export const config = {
|
||||
matcher: [
|
||||
"/escaner",
|
||||
"/agregarEquipo",
|
||||
"/editar",
|
||||
"/crearCuenta",
|
||||
"/equipoComputo",
|
||||
"/perifericos",
|
||||
"/ranking",
|
||||
"/historial",
|
||||
"/cambiarPass"
|
||||
],
|
||||
};
|
||||
//IO
|
||||
|
||||
Reference in New Issue
Block a user