paginacion arreglada
This commit is contained in:
@@ -40,15 +40,25 @@
|
||||
|
||||
async function cargaPropiedades() {
|
||||
try{
|
||||
const response = await fetch($urlG+"/api/admin/busqueda/paginada?cantidadHabitaciones="+p.cantidadhabitaciones+"&tipoPropiedad="+p.tipopropiedad+"&servicios="+p.servicios+"&pag="+p.pag, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Auth": String(token)
|
||||
}
|
||||
});
|
||||
if (response.ok) {
|
||||
let data = await response.json();
|
||||
const [response, response2] = await Promise.all([
|
||||
fetch($urlG+"/api/admin/busqueda/paginada?cantidadHabitaciones="+p.cantidadhabitaciones+"&tipoPropiedad="+p.tipopropiedad+"&servicios="+p.servicios+"&pag="+p.pag, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Auth": String(token)
|
||||
}
|
||||
}),
|
||||
fetch($urlG+"/api/admin/busqueda/cantPag?cantidadHabitaciones="+p.cantidadhabitaciones+"&tipoPropiedad="+p.tipopropiedad+"&servicios="+p.servicios, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Auth": String(token)
|
||||
}
|
||||
})
|
||||
]);
|
||||
|
||||
if (response.ok && response2.ok) {
|
||||
const [data, data2] = await Promise.all([response.json(),response2.json()]);
|
||||
Propiedades = data;
|
||||
cantpag = data2.message;
|
||||
return;
|
||||
}
|
||||
modaldata = "Fallo la request";
|
||||
@@ -56,31 +66,6 @@
|
||||
modaldata = "Fallo al intentar obtener la lista de propiedades";
|
||||
}
|
||||
}
|
||||
async function obtenerCant(){
|
||||
|
||||
try{
|
||||
const response = await fetch($urlG+"/api/propiedad/cantPagina?estado="+0, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Auth": String(token)
|
||||
}
|
||||
});
|
||||
if (response.ok) {
|
||||
let data = await response.json();
|
||||
cantpag = data.message;
|
||||
return;
|
||||
}
|
||||
if (response.status === 400) {
|
||||
let data = await response.json();
|
||||
modaldata=data.message;
|
||||
return;
|
||||
}
|
||||
modaldata="Fallo al recibir la peticion de la cantidad de paginas de propiedades";
|
||||
} catch {
|
||||
modaldata="Fallo al intentar hacer la peticion de cuantas paginas hay";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function queryPag(a:number){
|
||||
p.pag = a;
|
||||
@@ -107,7 +92,7 @@
|
||||
<AdminPropiedad prop={p} modal={(a:string)=> modaldata = a} />
|
||||
<br>
|
||||
{/each}
|
||||
<PaginacionStepper currentPag={p.pag} {queryPag}/>
|
||||
<PaginacionStepper currentPag={p.pag} {queryPag} {cantpag}/>
|
||||
</div>
|
||||
<div class="col col-md-4 order-1">
|
||||
<PanelBusqueda Params={querybusc} />
|
||||
|
||||
Reference in New Issue
Block a user