From 1e0b65a0a4556810ad4a7acac764a57a7daf8cf0 Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Fri, 31 Jan 2020 07:10:34 +0100 Subject: viewer: minor code cleaning --- viewer/src/plugins/router.ts | 8 ++++---- viewer/src/store/galleryStore.ts | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'viewer/src') diff --git a/viewer/src/plugins/router.ts b/viewer/src/plugins/router.ts index 0f3d2c7..8b4a8dc 100644 --- a/viewer/src/plugins/router.ts +++ b/viewer/src/plugins/router.ts @@ -19,17 +19,17 @@ import Vue from "vue"; import VueRouter from "vue-router"; -import Gallery from "@/views/MainGallery.vue"; +import MainGallery from "@/views/MainGallery.vue"; Vue.use(VueRouter); -// async way : component: () => import(/* webpackChunkName: "Gallery" */ "@/views/Gallery.vue"), +// async way : component: () => import(/* webpackChunkName: "MainGallery" */ "@/views/MainGallery.vue"), const routes = [ { path: "*", - name: "Gallery", - component: Gallery, + name: "MainGallery", + component: MainGallery, props: true }, ]; diff --git a/viewer/src/store/galleryStore.ts b/viewer/src/store/galleryStore.ts index b2ff74e..1c95fe7 100644 --- a/viewer/src/store/galleryStore.ts +++ b/viewer/src/store/galleryStore.ts @@ -46,15 +46,15 @@ export default class GalleryStore extends VuexModule { } get currentItemPath(): Gallery.Item[] { - const galleryItemsRoot = this.galleryItemsRoot; - if (galleryItemsRoot) - return GalleryStore.searchCurrentItemPath(galleryItemsRoot, this.currentPath); + const root = this.galleryItemsRoot; + if (root) + return GalleryStore.searchCurrentItemPath(root, this.currentPath); return []; } get currentItem(): Gallery.Item | null { - const currentItemPath = this.currentItemPath; - return currentItemPath.length > 0 ? currentItemPath[currentItemPath.length - 1] : null; + const path = this.currentItemPath; + return path.length > 0 ? path[path.length - 1] : null; } // --- @@ -69,9 +69,9 @@ export default class GalleryStore extends VuexModule { // Indexes the gallery @action async indexTags() { + const root = this.galleryItemsRoot; let index = {}; - if (this.galleryItemsRoot) - GalleryStore.pushTagsForItem(index, this.galleryItemsRoot); + if (root) GalleryStore.pushTagsForItem(index, root); console.log("Index: ", index); this.setTags(index); } -- cgit v1.2.3