summaryrefslogtreecommitdiff
path: root/frontend/src/sagas/game.js
diff options
context:
space:
mode:
authorJoffrey BION <joffrey.bion@gmail.com>2019-05-03 00:43:11 +0200
committerJoffrey BION <joffrey.bion@gmail.com>2019-05-03 00:43:11 +0200
commitd7f9f2470b972fbdc5b9b0aec2f939f1799968c8 (patch)
treeca3eaf2c90769d1a71c52d24a2fab9e568f18ee6 /frontend/src/sagas/game.js
parentConvert api package to typescript (diff)
downloadseven-wonders-d7f9f2470b972fbdc5b9b0aec2f939f1799968c8.tar.gz
seven-wonders-d7f9f2470b972fbdc5b9b0aec2f939f1799968c8.tar.bz2
seven-wonders-d7f9f2470b972fbdc5b9b0aec2f939f1799968c8.zip
Convert redux actions to typescript
Diffstat (limited to 'frontend/src/sagas/game.js')
-rw-r--r--frontend/src/sagas/game.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/frontend/src/sagas/game.js b/frontend/src/sagas/game.js
index dc92e89a..661c277b 100644
--- a/frontend/src/sagas/game.js
+++ b/frontend/src/sagas/game.js
@@ -2,9 +2,8 @@ import { eventChannel } from 'redux-saga';
import { apply, call, put, take } from 'redux-saga/effects';
import type { ApiPlayerTurnInfo, ApiPreparedCard, ApiTable } from '../api/model';
import { SevenWondersSession } from '../api/sevenWondersApi';
-import { actions } from '../redux/actions/game';
-import { types } from '../redux/actions/game';
-import { types as gameTypes } from '../redux/actions/lobby';
+import { actions, REQUEST_PREPARE_MOVE, REQUEST_SAY_READY } from '../redux/actions/game';
+import { ENTER_GAME } from '../redux/actions/lobby';
function* watchPlayerReady(session: SevenWondersSession, gameId: number) {
const channel = yield eventChannel(session.watchPlayerReady(gameId));
@@ -44,14 +43,14 @@ function* watchPreparedCards(session: SevenWondersSession, gameId: number) {
function* sayReady(session: SevenWondersSession) {
while (true) {
- yield take(types.REQUEST_SAY_READY);
+ yield take(REQUEST_SAY_READY);
yield apply(session, session.sayReady);
}
}
function* prepareMove(session: SevenWondersSession) {
while (true) {
- let action = yield take(types.REQUEST_PREPARE_MOVE);
+ let action = yield take(REQUEST_PREPARE_MOVE);
yield apply(session, session.prepareMove, [action.move]);
}
}
@@ -69,7 +68,7 @@ function* watchTurnInfo(session: SevenWondersSession) {
}
export function* gameSaga(session: SevenWondersSession) {
- const { gameId } = yield take(gameTypes.ENTER_GAME);
+ const { gameId } = yield take(ENTER_GAME);
console.log('Entered game!', gameId);
yield [
call(watchPlayerReady, session, gameId),
bgstack15