diff --git a/front/core/services/app.js b/front/core/services/app.js index 8c628aaa5..889b24d01 100644 --- a/front/core/services/app.js +++ b/front/core/services/app.js @@ -43,6 +43,17 @@ export default class App { getVersion() { this.logger.$http.get('Applications/status'); } + + setVersion(newVersion) { + if (newVersion) { + const currentVersion = localStorage.getItem('salix-version'); + if (newVersion != currentVersion) { + this.hasNewVersion = true; + clearInterval(this.versionInterval); + } + localStorage.setItem('salix-version', newVersion); + } + } } ngModule.service('vnApp', App); diff --git a/front/core/services/interceptor.js b/front/core/services/interceptor.js index ad2227332..3f3d9912b 100644 --- a/front/core/services/interceptor.js +++ b/front/core/services/interceptor.js @@ -30,15 +30,9 @@ function interceptor($q, vnApp, vnToken, $translate) { }, response(response) { vnApp.popLoader(); - const currentVersion = localStorage.getItem('salix-version'); const newVersion = response.headers('salix-version'); - if (newVersion) { - if (newVersion != currentVersion) { - vnApp.hasNewVersion = true; - clearInterval(vnApp.versionInterval); - } - localStorage.setItem('salix-version', newVersion); - } + vnApp.setVersion(newVersion); + return response; }, responseError(rejection) {