diff options
Diffstat (limited to 'frontend/src/sagas.js')
-rw-r--r-- | frontend/src/sagas.js | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/frontend/src/sagas.js b/frontend/src/sagas.js index 7c356e1d..df49b099 100644 --- a/frontend/src/sagas.js +++ b/frontend/src/sagas.js @@ -1,22 +1,11 @@ import { router } from 'redux-saga-router' import { call } from 'redux-saga/effects' +import { makeSagaRoutes } from './routes' import createWsConnection from './utils/createWebSocketConnection' -import usernameChoiceSaga from './sagas/usernameChoice' -import gameBrowserSaga from './sagas/gameBrowser' - -let wsConnection -const routes = { - *'/'() { - yield usernameChoiceSaga(wsConnection) - }, - *'/games'() { - yield gameBrowserSaga(wsConnection) - } -} - export default function *rootSaga(history) { + let wsConnection try { wsConnection = yield call(createWsConnection) } catch (error) { @@ -24,5 +13,5 @@ export default function *rootSaga(history) { return } - yield* router(history, routes) + yield* router(history, makeSagaRoutes(wsConnection)) } |