Skip to content

Commit

Permalink
chore: Update gamesSlice.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
jy95 authored Jun 24, 2024
1 parent 8f04ccf commit 90a2063
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/redux/features/gamesSlice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const gamesSlice = createSlice({
reducers: {
filteringByGenre(state : GamesState, action: PayloadAction<GenreValue[]>) {
// If empty, remove filter - if not, add it
let newFilters = state.activeFilters.filter(s => s.key !== "selected_genres");
let newFilters = state.activeFilters.filter(s => s.key !== "selected_genres") as gamesFilters;
if (action.payload.length !== 0) {
newFilters.push({
key: "selected_genres",
Expand All @@ -56,7 +56,7 @@ const gamesSlice = createSlice({
},
filterByTitle(state : GamesState, action: PayloadAction<string>) {
// If empty, remove filter - if not, add it
let newFilters = state.activeFilters.filter(s => s.key !== "selected_title");
let newFilters = state.activeFilters.filter(s => s.key !== "selected_title") as gamesFilters;
if (action.payload.length !== 0) {
newFilters.push({
key: "selected_title",
Expand All @@ -67,7 +67,7 @@ const gamesSlice = createSlice({
},
filterByPlatform(state : GamesState, action: PayloadAction<Platform | "">) {
// If empty, remove filter - if not, add it
let newFilters = state.activeFilters.filter(s => s.key !== "selected_platform");
let newFilters = state.activeFilters.filter(s => s.key !== "selected_platform") as gamesFilters;
if (action.payload.length !== 0) {
newFilters.push({
key: "selected_platform",
Expand Down Expand Up @@ -129,4 +129,4 @@ export const selectSelectedTitle = createSelector(

// Action creators are generated for each case reducer function
export const { filteringByGenre, filterByTitle, filterByPlatform } = gamesSlice.actions;
export default gamesSlice.reducer;
export default gamesSlice.reducer;

0 comments on commit 90a2063

Please sign in to comment.