5554-renovar_token #1566
|
@ -4,3 +4,7 @@ CREATE TABLE `salix`.`accessTokenConfig` (
|
||||||
`renewInterval` int(10) unsigned DEFAULT NULL,
|
`renewInterval` int(10) unsigned DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||||
|
|
||||||
|
INSERT IGNORE INTO `salix`.`accessTokenConfig` (`id`, `renewPeriod`, `renewInterval`)
|
||||||
|
VALUES
|
||||||
|
(1, 21600, 300);
|
||||||
|
|
|
@ -2888,4 +2888,4 @@ INSERT INTO `vn`.`wagonTypeTray` (`id`, `typeFk`, `height`, `colorFk`)
|
||||||
|
|
||||||
INSERT INTO `salix`.`accessTokenConfig` (`id`, `renewPeriod`, `renewInterval`)
|
INSERT INTO `salix`.`accessTokenConfig` (`id`, `renewPeriod`, `renewInterval`)
|
||||||
VALUES
|
VALUES
|
||||||
(0, 50, 100);
|
(1, 21600, 300);
|
||||||
|
|
|
@ -18,11 +18,13 @@ export class Layout extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
getAccessTokenConfig() {
|
getAccessTokenConfig() {
|
||||||
this.$http.get('AccessTokenConfigs/findOne').then(json => {
|
this.$http.get('AccessTokenConfigs').then(json => {
|
||||||
window.localStorage.renewPeriod = json.data.renewPeriod;
|
const firtsResult = json.data[0];
|
||||||
window.localStorage.renewInterval = json.data.renewInterval;
|
if (!firtsResult) return;
|
||||||
|
window.localStorage.renewPeriod = firtsResult.renewPeriod;
|
||||||
|
window.localStorage.renewInterval = firtsResult.renewInterval;
|
||||||
|
|
||||||
const intervalMilliseconds = json.data.renewInterval * 1000;
|
const intervalMilliseconds = firtsResult.renewInterval * 1000;
|
||||||
this.inservalId = setInterval(this.checkTokenValidity.bind(this), intervalMilliseconds);
|
this.inservalId = setInterval(this.checkTokenValidity.bind(this), intervalMilliseconds);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -35,7 +37,6 @@ export class Layout extends Component {
|
||||||
if (differenceSeconds > window.localStorage.renewPeriod) {
|
if (differenceSeconds > window.localStorage.renewPeriod) {
|
||||||
this.$http.post('VnUsers/renewToken')
|
this.$http.post('VnUsers/renewToken')
|
||||||
.then(json => {
|
.then(json => {
|
||||||
console.log('fin renewToken');
|
|
||||||
if (json.data.token) {
|
if (json.data.token) {
|
||||||
vicent marked this conversation as resolved
Outdated
|
|||||||
let remember = true;
|
let remember = true;
|
||||||
if (window.sessionStorage.vnToken) remember = false;
|
if (window.sessionStorage.vnToken) remember = false;
|
||||||
|
|
Loading…
Reference in New Issue
No guardar
renewPeriod
yrenewInterval
enlocalStorage
, guardarlos enthis