mirror of https://gitlab.com/m3f_usm/cms-sveltekit
se agrega zoom datos de paradero en modo celular, y se reintenta obtener datos
parent
b9c527e3c8
commit
f1469e82a1
|
@ -5,8 +5,8 @@
|
||||||
<footer class="footer1">
|
<footer class="footer1">
|
||||||
|
|
||||||
<div class="container py-3">
|
<div class="container py-3">
|
||||||
<img src={`${base}/images/Biobio-Puede-Mas.png`} alt="Biobio puede más" height="137">
|
|
||||||
<img src={`${base}/images/gobierno-regional.png`} alt="Gobierno regional" height="137">
|
<img src={`${base}/images/gobierno-regional.png`} alt="Gobierno regional" height="137">
|
||||||
|
<img src={`${base}/images/Biobio-Puede-Mas.png`} alt="Biobio puede más" height="137">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="footer2">
|
<div class="footer2">
|
||||||
|
|
|
@ -5,13 +5,35 @@ const {
|
||||||
VITE_TRANSPORTE_PASS: password
|
VITE_TRANSPORTE_PASS: password
|
||||||
} = import.meta.env;
|
} = import.meta.env;
|
||||||
|
|
||||||
|
let intentos = 0;
|
||||||
|
|
||||||
export async function load({ url }) {
|
export async function load({ url }) {
|
||||||
const id = url.searchParams.get('id');
|
const id = url.searchParams.get('id');
|
||||||
|
|
||||||
if (!id) return null;
|
if (!id) return null;
|
||||||
|
return await tryFetch(id)
|
||||||
|
}
|
||||||
|
|
||||||
const token = await getToken() // token de autorizacion
|
function sleep(seconds) {
|
||||||
return await fetchParadero(id, token) // data de dispositivo
|
return new Promise((resolve) => {
|
||||||
|
setTimeout(() => { resolve() }, seconds * 1000)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function tryFetch(id) {
|
||||||
|
try {
|
||||||
|
const token = await getToken() // token de autorizacion
|
||||||
|
const data = await fetchParadero(id, token) // data de dispositivo
|
||||||
|
intentos = 0;
|
||||||
|
return data;
|
||||||
|
} catch (error) {
|
||||||
|
if (intentos < 3) {
|
||||||
|
intentos++;
|
||||||
|
await sleep(2); // espera 2 segundos
|
||||||
|
return await tryFetch(id)
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getToken() {
|
async function getToken() {
|
||||||
|
|
|
@ -177,6 +177,10 @@
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
.contenedor { zoom: .45 }
|
||||||
|
}
|
||||||
|
|
||||||
.rectangulo-pequeno {
|
.rectangulo-pequeno {
|
||||||
position: relative;
|
position: relative;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
Loading…
Reference in New Issue