diff --git a/front/salix/components/layout/index.js b/front/salix/components/layout/index.js index 099e3fd6e..08430c2e5 100644 --- a/front/salix/components/layout/index.js +++ b/front/salix/components/layout/index.js @@ -39,7 +39,7 @@ export class Layout extends Component { this.renewInterval = firtsResult.renewInterval; const intervalMilliseconds = firtsResult.renewInterval * 1000; - this.inservalId = setInterval(this.checkTokenValidity.bind(this), intervalMilliseconds); + this.inservalId = setInterval(() => this.checkTokenValidity(), intervalMilliseconds); }); } @@ -52,11 +52,6 @@ export class Layout extends Component { const nuevaFechaEnMilisegundos = fechaEnMilisegundos + duracionEnMilisegundos; // Sumar los milisegundos const nuevaFecha = new Date(nuevaFechaEnMilisegundos); // Crear una nueva fecha a partir de los milisegundos - // const created = new Date(this.vnToken.created); - // const createdInSeconds = Math.floor(created.getTime() / 1000); - // const maxSeconds = createdInSeconds + this.vnToken.ttl; - // const maxDate = new Date(maxSeconds); - const now = new Date(); console.log(now > nuevaFecha, now, nuevaFecha); if (now > nuevaFecha) { @@ -66,8 +61,12 @@ export class Layout extends Component { let remember = true; if (window.sessionStorage.vnToken) remember = false; - this.vnToken.set(json.data.token, new Date(), json.data.renewPeriod, remember); + this.vnToken.set(json.data.token, now, json.data.renewPeriod, remember); } + }) + .catch(res => { + if (res.status !== 405) + throw res; }); } }