diff options
Diffstat (limited to 'viewer/src/store')
-rw-r--r-- | viewer/src/store/uiStore.ts | 12 |
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 | ||
20 | import { createModule, mutation, action } from "vuex-class-component"; | 20 | import { createModule, mutation, action } from "vuex-class-component"; |
21 | import ItemComparators, { ItemComparator } from "@/services/itemComparators"; | 21 | import ItemComparators, { ItemSort } from "@/services/itemComparators"; |
22 | 22 | ||
23 | const VuexModule = createModule({ | 23 | const 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 | } |