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 () { mounted () {
window.axios.get('/api/settings/app/version').then((res) => { window.axios.get('/api/settings/app/version').then((res) => {
this.currentVersion = res.data.version this.currentVersion = res.data.version
}) })
}, },
methods: { methods: {
closeHandler () {
console.log('closing')
},
async onUpdateApp () { async onUpdateApp () {
try { try {
this.isUpdating = true this.isUpdating = true