blob: 037aa9ed9cc75e76d285a9b2c94c130b9fa73cdd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
// @flow
import { router } from 'redux-saga-router';
import { call, fork } from 'redux-saga/effects';
import { makeSagaRoutes } from './routes';
import { createWsConnection } from './utils/websocket';
import errorHandlingSaga from './sagas/errors';
import type { SocketObjectType } from './utils/websocket';
import type { History } from 'react-router';
export default function* rootSaga(history: History): * {
let wsConnection: SocketObjectType | void;
try {
wsConnection = yield call(createWsConnection);
} catch (error) {
console.error('Could not connect to socket');
return;
}
yield fork(errorHandlingSaga, wsConnection);
yield* router(history, makeSagaRoutes(wsConnection));
}
|