stop window from closing when update in progress

This commit is contained in:
Mohit Panjwani
2019-11-23 13:43:29 +05:30
parent 07601a7130
commit 8b54b48805

View File

@ -55,13 +55,22 @@ export default {
}
}
},
created () {
window.addEventListener('beforeunload', (event) => {
if (this.isUpdating) {
event.returnValue = 'Update is in progress!'
}
})
},
mounted () {
window.axios.get('/api/settings/app/version').then((res) => {
this.currentVersion = res.data.version
})
},
methods: {
closeHandler () {
console.log('closing')
},
async onUpdateApp () {
try {
this.isUpdating = true