From ff0cc4ad684d7cc737eea59c4dce9a97c636fb44 Mon Sep 17 00:00:00 2001 From: winkidney Date: Sat, 7 Dec 2019 22:02:01 +0800 Subject: [PATCH] Feature: Add loading for createPin --- pinry-spa/src/components/pin_edit/PinCreateModal.vue | 3 +++ pinry-spa/src/components/utils/Loading.js | 7 +++++++ 2 files changed, 10 insertions(+) create mode 100644 pinry-spa/src/components/utils/Loading.js diff --git a/pinry-spa/src/components/pin_edit/PinCreateModal.vue b/pinry-spa/src/components/pin_edit/PinCreateModal.vue index 85c4d26..4f9b307 100644 --- a/pinry-spa/src/components/pin_edit/PinCreateModal.vue +++ b/pinry-spa/src/components/pin_edit/PinCreateModal.vue @@ -90,6 +90,7 @@ import FileUpload from './FileUpload.vue'; import FilterSelect from './FilterSelect.vue'; import bus from '../utils/bus'; import ModelForm from '../utils/ModelForm'; +import Loading from '../utils/Loading'; function isURLBlank(url) { return url !== null && url === ''; @@ -194,6 +195,7 @@ export default { ); }, createPin() { + const loading = Loading.open(this); const self = this; let promise; if (isURLBlank(this.pinModel.form.url.value) && this.formUpload.imageId === null) { @@ -214,6 +216,7 @@ export default { bus.bus.$emit(bus.events.refreshPin); self.$emit('pinCreated', resp); self.$parent.close(); + loading.close(); if (self.boardIds !== null) { // FIXME(winkidney): Should handle error for add-to board self.boardIds.forEach( diff --git a/pinry-spa/src/components/utils/Loading.js b/pinry-spa/src/components/utils/Loading.js new file mode 100644 index 0000000..52b2f3c --- /dev/null +++ b/pinry-spa/src/components/utils/Loading.js @@ -0,0 +1,7 @@ +function open(vm) { + return vm.$buefy.loading.open({ container: null }); +} + +export default { + open, +};