summaryrefslogtreecommitdiff
path: root/frontend/src/sagas.ts
diff options
context:
space:
mode:
authorjbion <joffrey.bion@amadeus.com>2019-05-05 11:22:58 +0200
committerjbion <joffrey.bion@amadeus.com>2019-05-06 18:33:14 +0200
commit347877687301ec43367105a7f8c49fe16129fc00 (patch)
tree4999cf1978527658f70a21ce59d5f5d08a7169fd /frontend/src/sagas.ts
parentConvert reducers to typescript (diff)
downloadseven-wonders-347877687301ec43367105a7f8c49fe16129fc00.tar.gz
seven-wonders-347877687301ec43367105a7f8c49fe16129fc00.tar.bz2
seven-wonders-347877687301ec43367105a7f8c49fe16129fc00.zip
Convert redux sagas to TypeScript
Diffstat (limited to 'frontend/src/sagas.ts')
-rw-r--r--frontend/src/sagas.ts23
1 files changed, 23 insertions, 0 deletions
diff --git a/frontend/src/sagas.ts b/frontend/src/sagas.ts
new file mode 100644
index 00000000..03c71b63
--- /dev/null
+++ b/frontend/src/sagas.ts
@@ -0,0 +1,23 @@
+import { SagaIterator } from 'redux-saga';
+import { call, fork } from 'redux-saga/effects';
+import { connectToGame, SevenWondersSession } from './api/sevenWondersApi';
+import { errorHandlingSaga } from './sagas/errors';
+import { gameSaga } from './sagas/game';
+import { gameBrowserSaga } from './sagas/gameBrowser';
+import { homeSaga } from './sagas/home';
+import { lobbySaga } from './sagas/lobby';
+
+export function* rootSaga(): SagaIterator {
+ let sevenWondersSession: SevenWondersSession;
+ try {
+ sevenWondersSession = yield call(connectToGame);
+ } catch (error) {
+ console.error('Could not connect to socket', error);
+ return;
+ }
+ yield fork(errorHandlingSaga, sevenWondersSession);
+ yield fork(homeSaga, sevenWondersSession);
+ yield fork(gameBrowserSaga, sevenWondersSession);
+ yield fork(lobbySaga, sevenWondersSession);
+ yield fork(gameSaga, sevenWondersSession);
+}
bgstack15