diff options
author | Joffrey BION <joffrey.bion@gmail.com> | 2017-05-21 20:20:45 +0200 |
---|---|---|
committer | Joffrey BION <joffrey.bion@gmail.com> | 2017-05-22 00:23:02 +0200 |
commit | c03e68041e0f444e18a895058afbdf0d68759517 (patch) | |
tree | 6e31f9726d36e746f43c7856cebff8c861577e31 /frontend/src/sagas/lobby.js | |
parent | Clean name in websocket.js (diff) | |
download | seven-wonders-c03e68041e0f444e18a895058afbdf0d68759517.tar.gz seven-wonders-c03e68041e0f444e18a895058afbdf0d68759517.tar.bz2 seven-wonders-c03e68041e0f444e18a895058afbdf0d68759517.zip |
Update prettier config and reformat
Here's the discussion summary:
- single quote, because that's what I'm used to in the JS world
- trailing comma, to avoid unnecessary git changes
- print-width 120, because 120 still doesn't require to scroll horizontally, and vertical space is precious
Diffstat (limited to 'frontend/src/sagas/lobby.js')
-rw-r--r-- | frontend/src/sagas/lobby.js | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/frontend/src/sagas/lobby.js b/frontend/src/sagas/lobby.js index f092fdb7..d11511e8 100644 --- a/frontend/src/sagas/lobby.js +++ b/frontend/src/sagas/lobby.js @@ -1,25 +1,21 @@ -import { call, put, take, apply } from "redux-saga/effects"; -import { createSubscriptionChannel } from "../utils/websocket"; -import { push } from "react-router-redux"; +import { call, put, take, apply } from 'redux-saga/effects'; +import { createSubscriptionChannel } from '../utils/websocket'; +import { push } from 'react-router-redux'; -import { normalize } from "normalizr"; -import { game as gameSchema } from "../schemas/games"; +import { normalize } from 'normalizr'; +import { game as gameSchema } from '../schemas/games'; -import { actions as gameActions, types } from "../redux/games"; -import { actions as playerActions } from "../redux/players"; +import { actions as gameActions, types } from '../redux/games'; +import { actions as playerActions } from '../redux/players'; function getCurrentGameId() { const path = window.location.pathname; - return path.split("lobby/")[1]; + return path.split('lobby/')[1]; } function* watchLobbyUpdates({ socket }) { const currentGameId = getCurrentGameId(); - const lobbyUpdatesChannel = yield call( - createSubscriptionChannel, - socket, - `/topic/lobby/${currentGameId}/updated` - ); + const lobbyUpdatesChannel = yield call(createSubscriptionChannel, socket, `/topic/lobby/${currentGameId}/updated`); try { while (true) { const lobby = yield take(lobbyUpdatesChannel); @@ -34,15 +30,11 @@ function* watchLobbyUpdates({ socket }) { function* watchGameStart({ socket }) { const currentGameId = getCurrentGameId(); - const gameStartedChannel = yield call( - createSubscriptionChannel, - socket, - `/topic/lobby/${currentGameId}/started` - ); + const gameStartedChannel = yield call(createSubscriptionChannel, socket, `/topic/lobby/${currentGameId}/started`); try { yield take(gameStartedChannel); yield put(gameActions.enterGame()); - yield put(push("/game")); + yield put(push('/game')); } finally { yield apply(gameStartedChannel, gameStartedChannel.close); } @@ -51,7 +43,7 @@ function* watchGameStart({ socket }) { function* startGame({ socket }) { while (true) { yield take(types.REQUEST_START_GAME); - yield apply(socket, socket.send, ["/app/lobby/startGame", {}]); + yield apply(socket, socket.send, ['/app/lobby/startGame', {}]); } } @@ -59,7 +51,7 @@ function* lobbySaga(socketConnection) { yield [ call(watchLobbyUpdates, socketConnection), call(watchGameStart, socketConnection), - call(startGame, socketConnection) + call(startGame, socketConnection), ]; } |