move funcionality setVersion to vnApp
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2022-06-16 08:25:38 +02:00
parent a4aa3f9133
commit 1a88ccaae5
2 changed files with 13 additions and 8 deletions

View File

@ -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);

View File

@ -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) {