blob: c0adcde5dc1c653e95601bc34acb56b0015b90f9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
import { fork, take, cancel } from 'redux-saga/effects'
import usernameChoiceSaga from './sagas/usernameChoice'
import gameBrowserSaga from './sagas/gameBrowser'
import { LOCATION_CHANGE } from 'react-router-redux'
export const makeSagaRoutes = wsConnection => ({
*'/'() {
const saga = yield fork(usernameChoiceSaga, wsConnection)
yield take(LOCATION_CHANGE)
yield cancel(saga)
yield console.log('canceled home')
},
*'/games'() {
const saga = yield fork(gameBrowserSaga, wsConnection)
yield take(LOCATION_CHANGE)
yield cancel(saga)
yield console.log('canceled games')
}
})
import { LobbyLayout } from './layouts'
import HomePage from './containers/home'
import GameBrowser from './containers/gameBrowser'
import Error404 from './components/errors/Error404'
export const routes = [
{
path: '/',
component: LobbyLayout,
indexRoute: { component: HomePage },
childRoutes: [
{ path: '/games', component: GameBrowser }
]
},
{
path: '*',
component: Error404,
}
]
|