summaryrefslogtreecommitdiff
path: root/frontend/src/sagas
diff options
context:
space:
mode:
authorVictor Chabbert <chabbertvi@eisti.eu>2017-05-28 16:58:54 +0200
committerVictor Chabbert <chabbertvi@eisti.eu>2017-05-28 16:58:54 +0200
commitc3e86bed99863e38e6bbc5c42c34f8b8322228de (patch)
tree738e42b6158a0c80ceef989f6cf2a4ab4c0f52e6 /frontend/src/sagas
parentRemove unnecessary webjars (diff)
downloadseven-wonders-c3e86bed99863e38e6bbc5c42c34f8b8322228de.tar.gz
seven-wonders-c3e86bed99863e38e6bbc5c42c34f8b8322228de.tar.bz2
seven-wonders-c3e86bed99863e38e6bbc5c42c34f8b8322228de.zip
Change print width to 120, again
Diffstat (limited to 'frontend/src/sagas')
-rw-r--r--frontend/src/sagas/errors.js6
-rw-r--r--frontend/src/sagas/gameBrowser.js33
-rw-r--r--frontend/src/sagas/home.js16
-rw-r--r--frontend/src/sagas/lobby.js12
4 files changed, 12 insertions, 55 deletions
diff --git a/frontend/src/sagas/errors.js b/frontend/src/sagas/errors.js
index 4fd704a3..41eb6902 100644
--- a/frontend/src/sagas/errors.js
+++ b/frontend/src/sagas/errors.js
@@ -6,11 +6,7 @@ import { actions } from '../redux/errors';
import { toastr } from 'react-redux-toastr';
export default function* errorHandlingSaga({ socket }) {
- const errorChannel = yield call(
- createSubscriptionChannel,
- socket,
- '/user/queue/errors'
- );
+ const errorChannel = yield call(createSubscriptionChannel, socket, '/user/queue/errors');
try {
while (true) {
const error = yield take(errorChannel);
diff --git a/frontend/src/sagas/gameBrowser.js b/frontend/src/sagas/gameBrowser.js
index dd916df9..5492107a 100644
--- a/frontend/src/sagas/gameBrowser.js
+++ b/frontend/src/sagas/gameBrowser.js
@@ -3,28 +3,19 @@ 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 { game as gameSchema, gameList as gameListSchema } from '../schemas/games';
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 }), {}]);
}
}
diff --git a/frontend/src/sagas/home.js b/frontend/src/sagas/home.js
index 3f06e8f3..579c7fd6 100644
--- a/frontend/src/sagas/home.js
+++ b/frontend/src/sagas/home.js
@@ -7,19 +7,12 @@ import { actions, types } from '../redux/players';
function* sendUsername({ socket }) {
while (true) {
const { username } = yield take(types.REQUEST_CHOOSE_USERNAME);
- yield apply(socket, socket.send, [
- '/app/chooseName',
- JSON.stringify({ playerName: 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 usernameChannel = yield call(createSubscriptionChannel, socket, '/user/queue/nameChoice');
while (true) {
const user = yield take(usernameChannel);
yield put(actions.setCurrentPlayer(user));
@@ -30,10 +23,7 @@ function* validateUsername({ socket }) {
function* usernameChoiceSaga(wsConnection) {
// TODO: Run sendUsername in loop when we have the ability to cancel saga on route change
- yield [
- call(sendUsername, wsConnection),
- call(validateUsername, wsConnection),
- ];
+ yield [call(sendUsername, wsConnection), call(validateUsername, wsConnection)];
}
export default usernameChoiceSaga;
diff --git a/frontend/src/sagas/lobby.js b/frontend/src/sagas/lobby.js
index 7b52ad29..d11511e8 100644
--- a/frontend/src/sagas/lobby.js
+++ b/frontend/src/sagas/lobby.js
@@ -15,11 +15,7 @@ function getCurrentGameId() {
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,11 +30,7 @@ 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());
bgstack15