patch reducer compile warnings

This commit is contained in:
sorrelbri 2020-02-07 17:55:25 -08:00
parent 3f15e48eef
commit 24a8a4e991
3 changed files with 10 additions and 9 deletions

View file

@ -3,11 +3,12 @@ import { stateReducer } from '../reducer';
export const gamesReducer = (state, action) => {
switch(action.message) {
case 'SET_GAMES':
case 'SET_GAMES': {
const games = formatGames(action);;
return {...state, games};
}
case 'JOIN_REQUEST':
case 'JOIN_REQUEST': {
if (!Object.entries(state.user).length) {
const errAction = {
type: 'ERR',
@ -18,16 +19,18 @@ export const gamesReducer = (state, action) => {
}
const id = action.body;
return {...state, joinGame: id};
}
case 'UPDATE_BOARD':
case 'UPDATE_BOARD': {
console.log(action.body)
return {...state, board: action.body};
}
case 'SET_ACTIVE':
case 'SET_ACTIVE': {
return {...state, active: action.body};
}
default:
return state;
default: return state;
}
}

View file

@ -1,5 +1,3 @@
import { stateReducer } from '../reducer';
export const messagesReducer = (state, action) => {
switch(action.message) {

View file

@ -61,7 +61,7 @@ function connectGame (state, action) {
}
function makeMove (state, action) {
const { user, game, room, board, move } = action.body;
// const { user, game, room, board, move } = action.body;
const socket = state.socket;
console.log(action)
socket.emit('make_move', {...action.body});