diff options
author | Joffrey BION <joffrey.bion@gmail.com> | 2017-07-24 23:51:43 +0200 |
---|---|---|
committer | Joffrey BION <joffrey.bion@gmail.com> | 2017-07-24 23:52:40 +0200 |
commit | 324b51049acac27ea3e7f71acad47aa729dfd8db (patch) | |
tree | 198640ae8788e6275e061cf38cea621206160bbf /frontend/src/sagas/gameBrowser.js | |
parent | Upgrade flow-bin (diff) | |
download | seven-wonders-324b51049acac27ea3e7f71acad47aa729dfd8db.tar.gz seven-wonders-324b51049acac27ea3e7f71acad47aa729dfd8db.tar.bz2 seven-wonders-324b51049acac27ea3e7f71acad47aa729dfd8db.zip |
Improve sevenWondersApi and types
Diffstat (limited to 'frontend/src/sagas/gameBrowser.js')
-rw-r--r-- | frontend/src/sagas/gameBrowser.js | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/frontend/src/sagas/gameBrowser.js b/frontend/src/sagas/gameBrowser.js index 871908f6..5b815f8d 100644 --- a/frontend/src/sagas/gameBrowser.js +++ b/frontend/src/sagas/gameBrowser.js @@ -1,17 +1,16 @@ // @flow -import { call, put, take, apply } from 'redux-saga/effects'; -import { push } from 'react-router-redux'; +import { normalize } from 'normalizr' +import { push } from 'react-router-redux' +import { eventChannel } from 'redux-saga' +import { apply, call, put, take } from 'redux-saga/effects' +import type { SevenWondersSession } from '../api/sevenWondersApi' -import { normalize } from 'normalizr'; -import { game as gameSchema, gameList as gameListSchema } from '../schemas/games'; - -import { actions as gameActions, types } from '../redux/games'; -import { actions as playerActions } from '../redux/players'; -import type { SevenWondersSession } from '../api/sevenWondersApi'; -import { createChannel } from './utils'; +import { actions as gameActions, types } from '../redux/games' +import { actions as playerActions } from '../redux/players' +import { game as gameSchema, gameList as gameListSchema } from '../schemas/games' function* watchGames(session: SevenWondersSession): * { - const gamesChannel = yield createChannel(session, session.watchGames); + const gamesChannel = yield eventChannel(session.watchGames()); try { while (true) { const gameList = yield take(gamesChannel); @@ -26,7 +25,7 @@ function* watchGames(session: SevenWondersSession): * { } function* watchLobbyJoined(session: SevenWondersSession): * { - const joinedLobbyChannel = yield createChannel(session, session.watchLobbyJoined); + const joinedLobbyChannel = yield eventChannel(session.watchLobbyJoined()); try { const joinedLobby = yield take(joinedLobbyChannel); const normalized = normalize(joinedLobby, gameSchema); |