From c03e68041e0f444e18a895058afbdf0d68759517 Mon Sep 17 00:00:00 2001 From: Joffrey BION Date: Sun, 21 May 2017 20:20:45 +0200 Subject: 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 --- frontend/src/sagas/lobby.js | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) (limited to 'frontend/src/sagas/lobby.js') 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), ]; } -- cgit