fix torrents by tag, fix #158

This commit is contained in:
CzBiX
2023-05-13 17:22:02 +08:00
parent d9994f152c
commit 49bf2f0694

View File

@@ -13,6 +13,7 @@ import searchEngineStore from './searchEngine';
import { RootState } from './types';
import stateMerge from '@/utils/vue-object-merge';
import api from '@/Api';
import { Torrent } from '@/types'
Vue.use(Vuex);
@@ -122,11 +123,11 @@ const store = new Vuex.Store<RootState>({
return groupBy(getters.allTorrents, torrent => torrent.category);
},
torrentGroupByTag(state, getters) {
const result: any = {}
const result: Record<string, Torrent[]> = {}
for (const torrent of getters.allTorrents) {
const tags: any[] = torrent.tags.split(",");
const tags: string[] = torrent.tags.split(', ');
tags.forEach(tag => {
let list: any[] = result[tag]
let list: Torrent[] = result[tag]
if (!list) {
list = []
result[tag] = list;