From 9e4fdd6f38853d8a4a959901ab7902569de75484 Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Sat, 21 Dec 2019 08:08:54 +0100 Subject: viewer: Implemented the "example" project in devServer Display loader and error messages (not translated yet) Created a "GalleryStore" to fetch the JSon data from the gallery (currently from example) --- viewer/src/views/LdGallery.vue | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'viewer/src/views') diff --git a/viewer/src/views/LdGallery.vue b/viewer/src/views/LdGallery.vue index ecdfa1b..04474c3 100644 --- a/viewer/src/views/LdGallery.vue +++ b/viewer/src/views/LdGallery.vue @@ -4,6 +4,7 @@
panel
+ @@ -11,7 +12,32 @@ import { Component, Vue } from "vue-property-decorator"; @Component -export default class LdGallery extends Vue {} +export default class LdGallery extends Vue { + isLoading: boolean = false; + + mounted() { + this.fetchGalleryItems(); + } + + fetchGalleryItems() { + this.isLoading = true; + this.$galleryStore + .fetchGalleryItems("/gallery/index.json") + .finally(() => (this.isLoading = false)) + .catch(this.displayError); + } + + displayError(reason: any) { + this.$buefy.snackbar.open({ + message: `Error ${reason}`, + actionText: "Retry", + position: "is-top", + type: "is-danger", + indefinite: true, + onAction: this.fetchGalleryItems, + }); + } +}