diff --git a/db/changes/232201/00-salix.sql b/db/changes/232201/00-salix.sql index 75b64500a..dc1ed69be 100644 --- a/db/changes/232201/00-salix.sql +++ b/db/changes/232201/00-salix.sql @@ -4,3 +4,7 @@ CREATE TABLE `salix`.`accessTokenConfig` ( `renewInterval` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + +INSERT IGNORE INTO `salix`.`accessTokenConfig` (`id`, `renewPeriod`, `renewInterval`) + VALUES + (1, 21600, 300); diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index cd4aca4bc..24ea1ad08 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -2888,4 +2888,4 @@ INSERT INTO `vn`.`wagonTypeTray` (`id`, `typeFk`, `height`, `colorFk`) INSERT INTO `salix`.`accessTokenConfig` (`id`, `renewPeriod`, `renewInterval`) VALUES - (0, 50, 100); + (1, 21600, 300); diff --git a/front/salix/components/layout/index.js b/front/salix/components/layout/index.js index 315632201..dd8a69ac7 100644 --- a/front/salix/components/layout/index.js +++ b/front/salix/components/layout/index.js @@ -18,11 +18,13 @@ export class Layout extends Component { } getAccessTokenConfig() { - this.$http.get('AccessTokenConfigs/findOne').then(json => { - window.localStorage.renewPeriod = json.data.renewPeriod; - window.localStorage.renewInterval = json.data.renewInterval; + this.$http.get('AccessTokenConfigs').then(json => { + const firtsResult = json.data[0]; + 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); }); } @@ -35,7 +37,6 @@ export class Layout extends Component { if (differenceSeconds > window.localStorage.renewPeriod) { this.$http.post('VnUsers/renewToken') .then(json => { - console.log('fin renewToken'); if (json.data.token) { let remember = true; if (window.sessionStorage.vnToken) remember = false;