summaryrefslogtreecommitdiff
path: root/frontend/src/sagas.js
blob: ab590a0d952466ab8660617ff58d6e4d69e0a74d (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
import { router } from 'redux-saga-router'
import { call } from 'redux-saga/effects'

import createWsConnection from './utils/createWebSocketConnection'

import homeSaga from './sagas/home'

let wsConnection
const routes = {
  *'/'() {
    yield homeSaga(wsConnection)
  }
}

export default function *rootSaga(history) {
  try {
    wsConnection = yield call(createWsConnection)
  } catch (error) {
    console.error('Could not connect to socket')
    return
  }

  yield* router(history, routes)
}
bgstack15