Moved UI error handling to mixin

This commit is contained in:
Joel Collins 2019-04-25 14:22:40 +01:00
parent 55e527c229
commit 12c7298023
10 changed files with 44 additions and 69 deletions

View file

@ -175,7 +175,6 @@
<script>
import axios from 'axios'
import UIkit from 'uikit';
// Export main app
export default {
@ -279,7 +278,7 @@ export default {
this.$root.$emit('globalUpdateCaptureList')
})
.catch(error => {
this.$store.dispatch('handleHTTPError', error); // Let store handle error
this.modalError(error) // Let mixin handle error
})
},
@ -291,10 +290,10 @@ export default {
return this.$store.dispatch('pollTask', [response.data.id, 3600, 5])
})
.then(() => {
UIkit.notification({message: "Finished scan.", status: 'success'})
this.modalNotify("Finished scan.")
})
.catch(error => {
this.$store.dispatch('handleHTTPError', error); // Let store handle error
this.modalError(error)
})
.finally(() => {
this.isScanning = false