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

@ -105,15 +105,14 @@ export default {
console.log(this.newtag);
this.newTagRequest(this.newtag);
this.newtag = "";
UIkit.modal(event.target.parentNode).hide();
UIkit.modal(event.target.parentNode).hide(); // TODO: Remove somehow
},
delCaptureConfirm: function(tag_string) {
var context = this
UIkit.modal.confirm('Permanantly delete capture?').then(function() {
this.modalConfirm('Permanantly delete capture?')
.then(function() {
context.delCaptureRequest()
}, function () {
console.log('Rejected.')
});
},
@ -125,7 +124,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
})
},
@ -137,16 +136,14 @@ export default {
this.getTagRequest()
})
.catch(error => {
this.$store.dispatch('handleHTTPError', error); // Let store handle error
this.modalError(error) // Let mixin handle error
})
},
delTagConfirm: function(tag_string) {
var context = this;
UIkit.modal.confirm(`Remove tag '${tag_string}'?`).then(function() {
this.modalConfirm(`Remove tag '${tag_string}'?`).then(function() {
context.delTagRequest(tag_string)
}, function () {
console.log('Rejected.')
});
},
@ -159,7 +156,7 @@ export default {
this.getTagRequest()
})
.catch(error => {
this.$store.dispatch('handleHTTPError', error); // Let store handle error
this.modalError(error) // Let mixin handle error
})
},
@ -170,7 +167,7 @@ export default {
this.tags = response.data.metadata.tags
})
.catch(error => {
this.$store.dispatch('handleHTTPError', error); // Let store handle error
this.modalError(error) // Let mixin handle error
})
},

View file

@ -44,7 +44,6 @@
</template>
<script>
import UIkit from 'uikit';
import axios from 'axios'
// Export main app

View file

@ -99,7 +99,7 @@ export default {
this.captureList = response.data; // Update boxes from response
})
.catch(error => {
this.$store.dispatch('handleHTTPError', error); // Let store handle error
this.modalError(error) // Let mixin handle error
})
},

View file

@ -156,7 +156,7 @@ export default {
this.$store.dispatch('updateState'); // Update store state
})
.catch(error => {
this.$store.dispatch('handleHTTPError', error); // Let store handle error
this.modalError(error) // Let mixin handle error
})
}
},