diff options
author | John Molakvoæ <skjnldsv@protonmail.com> | 2023-04-18 11:55:49 +0200 |
---|---|---|
committer | John Molakvoæ <skjnldsv@protonmail.com> | 2023-04-19 11:57:44 +0200 |
commit | fb0fe5c01c815b7fb2aac0799f9c8c63552d5969 (patch) | |
tree | de1af9eb92540113a5d662c4f747c84bfa145675 /apps/files | |
parent | 9db33055b208518601ff7b389188c032f8792e39 (diff) | |
download | nextcloud-server-fb0fe5c01c815b7fb2aac0799f9c8c63552d5969.tar.gz nextcloud-server-fb0fe5c01c815b7fb2aac0799f9c8c63552d5969.zip |
fix(files): fix sorting mixin usage
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/src/mixins/filesSorting.ts | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/apps/files/src/mixins/filesSorting.ts b/apps/files/src/mixins/filesSorting.ts index 8930587ffab..2f79a3eb171 100644 --- a/apps/files/src/mixins/filesSorting.ts +++ b/apps/files/src/mixins/filesSorting.ts @@ -21,18 +21,14 @@ */ import Vue from 'vue' +import { mapState } from 'pinia' import { useViewConfigStore } from '../store/viewConfig' -import type { Navigation } from '../services/Navigation' +import type { Navigation } from '../services/Navigation' export default Vue.extend({ - setup() { - const viewConfigStore = useViewConfigStore() - return { - viewConfigStore, - } - }, - computed: { + ...mapState(useViewConfigStore, ['getConfig', 'setSortingBy', 'toggleSortingDirection']), + currentView(): Navigation { return this.$navigation.active }, @@ -41,7 +37,7 @@ export default Vue.extend({ * Get the sorting mode for the current view */ sortingMode(): string { - return this.viewConfigStore.getConfig(this.currentView.id)?.sorting_mode + return this.getConfig(this.currentView.id)?.sorting_mode as string || this.currentView?.defaultSortKey || 'basename' }, @@ -50,7 +46,7 @@ export default Vue.extend({ * Get the sorting direction for the current view */ isAscSorting(): boolean { - const sortingDirection = this.viewConfigStore.getConfig(this.currentView.id)?.sorting_direction + const sortingDirection = this.getConfig(this.currentView.id)?.sorting_direction return sortingDirection === 'asc' }, }, @@ -59,11 +55,11 @@ export default Vue.extend({ toggleSortBy(key: string) { // If we're already sorting by this key, flip the direction if (this.sortingMode === key) { - this.viewConfigStore.toggleSortingDirection(this.currentView.id) + this.toggleSortingDirection(this.currentView.id) return } // else sort ASC by this new key - this.viewConfigStore.setSortingBy(key, this.currentView.id) + this.setSortingBy(key, this.currentView.id) }, }, }) |