All files / redux scrolledGamesSlice.ts

90.9% Statements 10/11
100% Branches 0/0
100% Functions 1/1
100% Lines 8/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 263x         3x   3x               5x 5x         7x   3x 4x  
import { createSlice } from "@reduxjs/toolkit"
import type { PayloadAction } from "@reduxjs/toolkit"
import { IGame } from "../pages/api/lib/interfaces/IGame"
import { InfiniteData } from "@tanstack/query-core"
 
const initialState: any = { pages: [], pageParams: [] }
 
export const scrolledGamesSlice = createSlice({
  name: "scrolledGames",
  initialState,
  reducers: {
    saveScrolledGames: (
      state,
      action: PayloadAction<InfiniteData<IGame[]>>
    ) => {
      state = action.payload
      return state
    },
  },
})
 
export const { saveScrolledGames } = scrolledGamesSlice.actions
 
const scrolledGamesReducer = scrolledGamesSlice.reducer
export default scrolledGamesReducer