import { put , delay } from "redux-saga/effects" ; import { select } from "typed-redux-saga" ; import { PlayerCommands , PlayerStateSelectors } from "@creature-chess/gamemode" ; export const sendInitialState = function * ( ) { yield delay ( 200 ) ; const cards = yield * select ( PlayerStateSelectors . getPlayerCards ) ; yield put ( PlayerCommands . updateCardsCommand ( cards ) ) ; const locked = yield * select ( PlayerStateSelectors . isPlayerShopLocked ) ; yield put ( PlayerCommands . updateShopLockCommand ( locked ) ) ; const money = yield * select ( PlayerStateSelectors . getPlayerMoney ) ; yield put ( PlayerCommands . updateMoneyCommand ( money ) ) ; const level = yield * select ( PlayerStateSelectors . getPlayerLevel ) ; const xp = yield * select ( PlayerStateSelectors . getPlayerXp ) ; yield put ( PlayerCommands . updateLevelCommand ( { level , xp } ) ) ; const health = yield * select ( PlayerStateSelectors . getPlayerHealth ) ; yield put ( PlayerCommands . updateHealthCommand ( health ) ) ; const opponentId = yield * select ( PlayerStateSelectors . getOpponentId ) ; yield put ( PlayerCommands . updateOpponentCommand ( opponentId ) ) ; } ;