aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/store
diff options
context:
space:
mode:
Diffstat (limited to 'viewer/src/store')
-rw-r--r--viewer/src/store/uiStore.ts12
1 files changed, 6 insertions, 6 deletions
diff --git a/viewer/src/store/uiStore.ts b/viewer/src/store/uiStore.ts
index 84e7fed..f065cdd 100644
--- a/viewer/src/store/uiStore.ts
+++ b/viewer/src/store/uiStore.ts
@@ -18,7 +18,7 @@
18*/ 18*/
19 19
20import { createModule, mutation, action } from "vuex-class-component"; 20import { createModule, mutation, action } from "vuex-class-component";
21import ItemComparators, { ItemComparator } from "@/services/itemComparators"; 21import ItemComparators, { ItemSort } from "@/services/itemComparators";
22 22
23const VuexModule = createModule({ 23const VuexModule = createModule({
24 namespaced: "uiStore", 24 namespaced: "uiStore",
@@ -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.DEFAULT; 32 sort: ItemSort = ItemComparators.DEFAULT;
33 33
34 // --- 34 // ---
35 35
@@ -45,14 +45,14 @@ export default class UIStore extends VuexModule {
45 this.searchMode = value ?? !this.searchMode; 45 this.searchMode = value ?? !this.searchMode;
46 } 46 }
47 47
48 @mutation setSortFn(sortFn: ItemComparator) { 48 @mutation setSort(sort: ItemSort) {
49 this.sortFn = sortFn; 49 this.sort = sort;
50 } 50 }
51 51
52 @action async initFromConfig(config: Gallery.Config) { 52 @action async initFromConfig(config: Gallery.Config) {
53 if (config.initialItemSort) { 53 if (config.initialItemSort) {
54 const itemSort = ItemComparators.ITEM_SORTS.find(s => s.name == config.initialItemSort); 54 const itemSort = ItemComparators.ITEM_SORTS[config.initialItemSort];
55 if (itemSort) this.setSortFn(itemSort.fn); 55 if (itemSort) this.setSort(itemSort);
56 else throw new Error("Unknown sort type: " + config.initialItemSort); 56 else throw new Error("Unknown sort type: " + config.initialItemSort);
57 } 57 }
58 } 58 }