diff options
author | Victor Chabbert <chabbertvi@eisti.eu> | 2017-01-20 23:18:57 +0100 |
---|---|---|
committer | Victor Chabbert <chabbertvi@eisti.eu> | 2017-01-20 23:25:26 +0100 |
commit | cc3db2982dc22899a9ebea21e8a8dfbfd710f842 (patch) | |
tree | d8e138b300a8d8fded0651ac6be204d8c3342e68 /frontend/src/containers/App/saga.js | |
parent | Remove shitty code and move generator stars to the right (diff) | |
download | seven-wonders-cc3db2982dc22899a9ebea21e8a8dfbfd710f842.tar.gz seven-wonders-cc3db2982dc22899a9ebea21e8a8dfbfd710f842.tar.bz2 seven-wonders-cc3db2982dc22899a9ebea21e8a8dfbfd710f842.zip |
DUCKS! Refactor front architecture
Diffstat (limited to 'frontend/src/containers/App/saga.js')
-rw-r--r-- | frontend/src/containers/App/saga.js | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/frontend/src/containers/App/saga.js b/frontend/src/containers/App/saga.js deleted file mode 100644 index 0c212142..00000000 --- a/frontend/src/containers/App/saga.js +++ /dev/null @@ -1,28 +0,0 @@ -import { put, take } from 'redux-saga/effects' -import { eventChannel } from 'redux-saga' - -function createSocketChannel(socket) { - return eventChannel(emit => { - const errorHandler = event => emit(JSON.parse(event.body)) - - const userErrors = socket.subscribe('/user/queue/errors', errorHandler) - - const unsubscribe = () => { - userErrors.unsubscribe() - } - - return unsubscribe - }) -} - -export function* watchOnErrors(socketConnection) { - const { socket } = socketConnection - const socketChannel = createSocketChannel(socket) - - while (true) { - const payload = yield take(socketChannel) - yield put({ type: 'USER_ERROR', payload }) - } -} - -export default watchOnErrors |