aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/store
diff options
context:
space:
mode:
authorZero~Informatique2020-02-13 18:17:35 +0100
committerZero~Informatique2020-02-13 18:17:35 +0100
commit6c51a97bce7963fba47892602c1214b3bcdcd410 (patch)
tree0df87fda5a480718cf35b6087555039a706df524 /viewer/src/store
parent9c2af5dcd2d2c8754e4c74e02141822c0964a5a8 (diff)
parentef1778e051e007f08f9188a479d04fdf95a57d21 (diff)
downloadldgallery-6c51a97bce7963fba47892602c1214b3bcdcd410.tar.gz
Merge branch 'oz-config-json' into develop
# Conflicts: # scripts/win_compile_example.cmd
Diffstat (limited to 'viewer/src/store')
-rw-r--r--viewer/src/store/galleryStore.ts18
1 files changed, 16 insertions, 2 deletions
diff --git a/viewer/src/store/galleryStore.ts b/viewer/src/store/galleryStore.ts
index 5ab0c33..d774588 100644
--- a/viewer/src/store/galleryStore.ts
+++ b/viewer/src/store/galleryStore.ts
@@ -27,12 +27,17 @@ const VuexModule = createModule({
27 27
28export default class GalleryStore extends VuexModule { 28export default class GalleryStore extends VuexModule {
29 29
30 config: Gallery.Config | null = null;
30 galleryItemsRoot: Gallery.Item | null = null; 31 galleryItemsRoot: Gallery.Item | null = null;
31 tags: Tag.Index = {}; 32 tags: Tag.Index = {};
32 currentPath: string = "/"; 33 currentPath: string = "/";
33 34
34 // --- 35 // ---
35 36
37 @mutation setConfig(config: Gallery.Config) {
38 this.config = config;
39 }
40
36 @mutation setGalleryItemsRoot(galleryItemsRoot: Gallery.Item) { 41 @mutation setGalleryItemsRoot(galleryItemsRoot: Gallery.Item) {
37 this.galleryItemsRoot = galleryItemsRoot; 42 this.galleryItemsRoot = galleryItemsRoot;
38 } 43 }
@@ -59,9 +64,18 @@ export default class GalleryStore extends VuexModule {
59 64
60 // --- 65 // ---
61 66
67 // Fetches the gallery's JSON config
68 @action async fetchConfig() {
69 return fetch(`${process.env.VUE_APP_DATA_URL}config.json`, { cache: "no-cache" })
70 .then(config => config.json())
71 .then(this.setConfig);
72 }
73
62 // Fetches the gallery's JSON metadata 74 // Fetches the gallery's JSON metadata
63 @action async fetchGalleryItems(url: string) { 75 @action async fetchGalleryItems() {
64 return fetch(url) 76 const root = this.config?.galleryRoot ?? '';
77 const timestamp = this.config?.generationTimestamp ?? 0;
78 return fetch(`${process.env.VUE_APP_DATA_URL}${root}index.json`, { cache: "no-cache" })
65 .then(response => response.json()) 79 .then(response => response.json())
66 .then(this.setGalleryItemsRoot) 80 .then(this.setGalleryItemsRoot)
67 .then(this.indexTags); 81 .then(this.indexTags);