import { createSlice , PayloadAction } from "@reduxjs/toolkit" ; import { Card } from "@creature-chess/models" ; export type CardShopState = { cards : ( Card | null ) [ ] ; locked : boolean ; } ; const initialState = { cards : [ ] , locked : false } ; const { actions , reducer : cardShopReducer , } = createSlice ( { name : "cards" , initialState , reducers : { updateCardsCommand : ( state , { payload : cards } ) => ( { ... state , cards } ) , updateShopLockCommand : ( state , { payload : locked } ) => ( { ... state , locked } ) } } ) ; const updateCardsCommand = actions . updateCardsCommand ; const updateShopLockCommand = actions . updateShopLockCommand ; export { updateCardsCommand , updateShopLockCommand , cardShopReducer } ;