aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/store/uiStore.ts
diff options
context:
space:
mode:
Diffstat (limited to 'viewer/src/store/uiStore.ts')
-rw-r--r--viewer/src/store/uiStore.ts15
1 files changed, 5 insertions, 10 deletions
diff --git a/viewer/src/store/uiStore.ts b/viewer/src/store/uiStore.ts
index 04f14a0..84e7fed 100644
--- a/viewer/src/store/uiStore.ts
+++ b/viewer/src/store/uiStore.ts
@@ -29,7 +29,7 @@ export default class UIStore extends VuexModule {
29 fullscreen: boolean = false; 29 fullscreen: boolean = false;
30 fullWidth: boolean = window.innerWidth < Number(process.env.VUE_APP_FULLWIDTH_LIMIT); 30 fullWidth: boolean = window.innerWidth < Number(process.env.VUE_APP_FULLWIDTH_LIMIT);
31 searchMode: boolean = false; 31 searchMode: boolean = false;
32 sortFn: ItemComparator = ItemComparators.sortByNameAsc; 32 sortFn: ItemComparator = ItemComparators.DEFAULT;
33 33
34 // --- 34 // ---
35 35
@@ -50,15 +50,10 @@ export default class UIStore extends VuexModule {
50 } 50 }
51 51
52 @action async initFromConfig(config: Gallery.Config) { 52 @action async initFromConfig(config: Gallery.Config) {
53 switch (config.initialSort ?? "") { 53 if (config.initialItemSort) {
54 case "date_desc": 54 const itemSort = ItemComparators.ITEM_SORTS.find(s => s.name == config.initialItemSort);
55 this.setSortFn(ItemComparators.sortByDateDesc); 55 if (itemSort) this.setSortFn(itemSort.fn);
56 break; 56 else throw new Error("Unknown sort type: " + config.initialItemSort);
57 case "name_asc":
58 case "":
59 break;
60 default:
61 throw new Error("Unknown sort type: " + config.initialSort);
62 } 57 }
63 } 58 }
64} 59}