summaryrefslogtreecommitdiff
path: root/frontend/src/sagas/home.js
diff options
context:
space:
mode:
authorjbion <joffrey.bion@amadeus.com>2017-05-19 20:17:35 +0200
committerJoffrey BION <joffrey.bion@gmail.com>2017-05-20 00:12:39 +0200
commita13f913c6a594a14a2cb9ab42dbd0493372583fb (patch)
tree2ac200b06532b7be09b0192a4455ab132cd5010b /frontend/src/sagas/home.js
parentSet versions of packages to latest (diff)
downloadseven-wonders-a13f913c6a594a14a2cb9ab42dbd0493372583fb.tar.gz
seven-wonders-a13f913c6a594a14a2cb9ab42dbd0493372583fb.tar.bz2
seven-wonders-a13f913c6a594a14a2cb9ab42dbd0493372583fb.zip
Add error toasts
Diffstat (limited to 'frontend/src/sagas/home.js')
-rw-r--r--frontend/src/sagas/home.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/frontend/src/sagas/home.js b/frontend/src/sagas/home.js
index 99e6f954..151fcb57 100644
--- a/frontend/src/sagas/home.js
+++ b/frontend/src/sagas/home.js
@@ -5,17 +5,20 @@ import { push } from 'react-router-redux'
import { actions, types } from '../redux/players'
function *sendUsername({ socket }) {
- const {username} = yield take(types.REQUEST_CHOOSE_USERNAME)
-
- yield apply(socket, socket.send, ['/app/chooseName', JSON.stringify({ playerName: username })])
+ while (true) {
+ const {username} = yield take(types.REQUEST_CHOOSE_USERNAME)
+ yield apply(socket, socket.send, ['/app/chooseName', JSON.stringify({playerName: username})])
+ }
}
function *validateUsername({ socket }) {
const usernameChannel = yield call(createSubscriptionChannel, socket, '/user/queue/nameChoice')
- const user = yield take(usernameChannel)
- yield put(actions.setCurrentPlayer(user))
- yield apply(usernameChannel, usernameChannel.close)
- yield put(push('/games'))
+ while (true) {
+ const user = yield take(usernameChannel)
+ yield put(actions.setCurrentPlayer(user))
+ yield apply(usernameChannel, usernameChannel.close)
+ yield put(push('/games'))
+ }
}
function *usernameChoiceSaga(wsConnection) {
bgstack15