summaryrefslogtreecommitdiff
path: root/frontend/src/sagas/gameBrowser.js
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/sagas/gameBrowser.js')
-rw-r--r--frontend/src/sagas/gameBrowser.js21
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);
bgstack15