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/gameBrowser.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/gameBrowser.js')
-rw-r--r-- | frontend/src/sagas/gameBrowser.js | 47 |
1 files changed, 13 insertions, 34 deletions
diff --git a/frontend/src/sagas/gameBrowser.js b/frontend/src/sagas/gameBrowser.js index 9f7e1565..5492107a 100644 --- a/frontend/src/sagas/gameBrowser.js +++ b/frontend/src/sagas/gameBrowser.js @@ -1,30 +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, - gameList as gameListSchema -} from "../schemas/games"; +import { normalize } from 'normalizr'; +import { game as gameSchema, gameList as gameListSchema } 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* watchGames({ socket }) { - const gamesChannel = yield call( - createSubscriptionChannel, - socket, - "/topic/games" - ); + const gamesChannel = yield call(createSubscriptionChannel, socket, '/topic/games'); try { while (true) { const gameList = yield take(gamesChannel); const normGameList = normalize(gameList, gameListSchema); // for an empty game array, there is no players/games entity maps - yield put( - playerActions.updatePlayers(normGameList.entities.players || {}) - ); + yield put(playerActions.updatePlayers(normGameList.entities.players || {})); yield put(gameActions.updateGames(normGameList.entities.games || {})); } } finally { @@ -33,11 +24,7 @@ function* watchGames({ socket }) { } function* watchLobbyJoined({ socket }) { - const joinedLobbyChannel = yield call( - createSubscriptionChannel, - socket, - "/user/queue/lobby/joined" - ); + const joinedLobbyChannel = yield call(createSubscriptionChannel, socket, '/user/queue/lobby/joined'); try { const joinedLobby = yield take(joinedLobbyChannel); const normalized = normalize(joinedLobby, gameSchema); @@ -54,22 +41,14 @@ function* watchLobbyJoined({ socket }) { function* createGame({ socket }) { while (true) { const { gameName } = yield take(types.REQUEST_CREATE_GAME); - yield apply(socket, socket.send, [ - "/app/lobby/create", - JSON.stringify({ gameName }), - {} - ]); + yield apply(socket, socket.send, ['/app/lobby/create', JSON.stringify({ gameName }), {}]); } } function* joinGame({ socket }) { while (true) { const { gameId } = yield take(types.REQUEST_JOIN_GAME); - yield apply(socket, socket.send, [ - "/app/lobby/join", - JSON.stringify({ gameId }), - {} - ]); + yield apply(socket, socket.send, ['/app/lobby/join', JSON.stringify({ gameId }), {}]); } } @@ -78,7 +57,7 @@ function* gameBrowserSaga(socketConnection) { call(watchGames, socketConnection), call(watchLobbyJoined, socketConnection), call(createGame, socketConnection), - call(joinGame, socketConnection) + call(joinGame, socketConnection), ]; } |