From b2bbcb987e7569bfb58bf01930f4d6cbcb9e95c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Marseault?= <22910497+Larsluph@users.noreply.github.com> Date: Thu, 26 Oct 2023 22:55:57 +0200 Subject: [PATCH] fix(dashboard): Sort not working anymore (#1211) --- src/stores/dashboard.ts | 11 ++++++++++- src/stores/maindata.ts | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/stores/dashboard.ts b/src/stores/dashboard.ts index dda028dc..c808909f 100644 --- a/src/stores/dashboard.ts +++ b/src/stores/dashboard.ts @@ -3,6 +3,7 @@ import { SortOptions } from '@/constants/qbit/SortOptions' import { formatData } from '@/helpers' import { useMaindataStore } from '@/stores/maindata' import { useVueTorrentStore } from '@/stores/vuetorrent' +import { GetTorrentPayload } from '@/types/qbit/payloads' import { defineStore } from 'pinia' import { computed, reactive, ref, watch } from 'vue' import { useI18n } from 'vue-i18n' @@ -65,6 +66,13 @@ export const useDashboardStore = defineStore( } }) + const getTorrentsPayload = computed(() => { + return { + sort: sortOptions.isCustomSortEnabled ? SortOptions.DEFAULT : sortOptions.sortBy, + reverse: sortOptions.reverseOrder + } + }) + function isTorrentInSelection(hash: string) { return selectedTorrents.value.includes(hash) } @@ -141,7 +149,8 @@ export const useDashboardStore = defineStore( spanTorrentSelection, selectAllTorrents, unselectAllTorrents, - toggleSelect + toggleSelect, + getTorrentsPayload } }, { diff --git a/src/stores/maindata.ts b/src/stores/maindata.ts index c3cc1eb4..d2ac3a6c 100644 --- a/src/stores/maindata.ts +++ b/src/stores/maindata.ts @@ -163,7 +163,7 @@ export const useMaindataStore = defineStore('maindata', () => { // fetch torrent data dashboardStore.sortOptions.isCustomSortEnabled = torrentBuilder.computedValues.indexOf(dashboardStore.sortOptions.sortBy) !== -1 - let data = await qbit.getTorrents() + let data = await qbit.getTorrents(dashboardStore.getTorrentsPayload) if (vueTorrentStore.showTrackerFilter) { trackers.value = data