Skip to content

Commit 3b530bc

Browse files
committed
fix: remove repeated code
1 parent 30444dc commit 3b530bc

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

src/lib/components/home/RandomGameButton.svelte

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,8 @@
55
import { goto } from '$app/navigation';
66
77
const getRandomGame = () => {
8-
let games = Object.entries(gamesStore.list);
9-
const selectedCategories = settingsStore.selectedCategories;
10-
if(selectedCategories.length) {
11-
games = games.filter(game =>
12-
game[1].categories.some(c => selectedCategories.includes(c)
13-
));
14-
}
8+
const games = Object.entries(gamesStore.filtered);
9+
console.log(games);
1510
if (games.length === 0) return;
1611
const randomIndex = Math.floor(Math.random() * games.length);
1712
const selectedGame = games[randomIndex][0];

0 commit comments

Comments
 (0)