From e8c90f687f5e0dc1a3636915a661caa3a2052bf7 Mon Sep 17 00:00:00 2001 From: Patrick Truong Date: Wed, 3 Oct 2018 21:46:56 -0700 Subject: [PATCH 1/3] update reducers to es6 syntax and add package lock to gitignore --- .gitignore | 1 + client/reducers/authReducer.js | 5 ++++- client/reducers/chatReducer.js | 15 +++++++++------ client/reducers/firepadReducer.js | 21 +++++++++++++++++---- client/reducers/inputReducer.js | 5 ++++- client/reducers/pchatReducer.js | 15 +++++++++------ client/reducers/roomChatReducer.js | 17 ++++++++++------- client/reducers/roomReducer.js | 23 ++++++++++++++--------- client/reducers/whiteboardReducer.js | 15 +++++++++------ 9 files changed, 77 insertions(+), 40 deletions(-) diff --git a/.gitignore b/.gitignore index 32fe222..8a6fea3 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ node_modules client/compiled dist npm-debug +package-lock.json diff --git a/client/reducers/authReducer.js b/client/reducers/authReducer.js index eff612e..c98558e 100644 --- a/client/reducers/authReducer.js +++ b/client/reducers/authReducer.js @@ -3,7 +3,10 @@ import { CHANGE_AUTH_FIELD } from '../actions/action'; const authReducer = (state = {}, action) => { switch (action.type) { case CHANGE_AUTH_FIELD: - return Object.assign({}, state, {[action.field]: action.value}); + return { + ...state, + [action.field]: action.value + }; default: return state; } diff --git a/client/reducers/chatReducer.js b/client/reducers/chatReducer.js index 77596b1..d889872 100644 --- a/client/reducers/chatReducer.js +++ b/client/reducers/chatReducer.js @@ -9,21 +9,24 @@ const initialState = { const chatReducer = (state = {}, action) => { switch (action.type) { case FETCHING_MESSAGES: - return Object.assign({}, state, { + return { + ...state, fetching: true - }); + }; case MESSAGES_FETCHED: - return Object.assign({}, state, { + return { + ...state, fetched: false, fetching: true, messages: action.payload - }); + }; case MESSAGES_ERROR: - return Object.assign({}, state, { + return { + ...state, fetching: false, fetched: true, error: action.payload - }); + }; default: return state; } diff --git a/client/reducers/firepadReducer.js b/client/reducers/firepadReducer.js index 6db2566..740acd3 100644 --- a/client/reducers/firepadReducer.js +++ b/client/reducers/firepadReducer.js @@ -10,13 +10,26 @@ const initialState = { const firepadReducer = (state = initialState, action) => { switch (action.type) { case FETCHING_FIREPAD: - return Object.assign({}, state, { fetching: true }); + return { + ...state, + fetching: true + }; case FIREPAD_FETCHED: - return Object.assign({}, state, { fetched: true, fetching: false}); + return { + ...state, + fetched: true, + fetching: false + }; case FIREPAD_MODE: - return Object.assign({}, state, { mode: action.mode }); + return { + ...state, + mode: action.mode + }; case TOGGLE_DIV: - return Object.assign({}, state, { hidden: !action.hidden }); + return { + ...state, + hidden: !action.hidden + }; default: return state; } diff --git a/client/reducers/inputReducer.js b/client/reducers/inputReducer.js index 1338690..8614d29 100644 --- a/client/reducers/inputReducer.js +++ b/client/reducers/inputReducer.js @@ -3,7 +3,10 @@ import { CHANGE_MESSAGE_TEXT } from '../actions/action'; const inputReducer = (state = {}, action) => { switch (action.type) { case CHANGE_MESSAGE_TEXT: - return Object.assign({}, state, {[action.field]: action.text}); + return { + ...state, + [action.field]: action.text + }; default: return state; } diff --git a/client/reducers/pchatReducer.js b/client/reducers/pchatReducer.js index 74954da..690feac 100644 --- a/client/reducers/pchatReducer.js +++ b/client/reducers/pchatReducer.js @@ -9,21 +9,24 @@ const initialState = { const pchatReducer = (state = {}, action) => { switch (action.type) { case FETCHING_PCHAT: - return Object.assign({}, state, { + return { + ...state, fetching: true - }); + }; case PCHAT_FETCHED: - return Object.assign({}, state, { + return { + ...state, fetched: false, fetching: true, privMessages: action.payload - }); + }; case PCHAT_ERROR: - return Object.assign({}, state, { + return { + ...state, fetching: false, fetched: true, error: action.payload - }); + }; default: return state; } diff --git a/client/reducers/roomChatReducer.js b/client/reducers/roomChatReducer.js index 755f7d3..0b290b5 100644 --- a/client/reducers/roomChatReducer.js +++ b/client/reducers/roomChatReducer.js @@ -9,24 +9,27 @@ const initialState = { const roomChatReducer = (state = initialState, action) => { switch (action.type) { case FETCHING_ROOM_MESSAGES: - return Object.assign({}, state, { + return { + ...state, fetching: true - }); + }; case ROOM_MESSAGES_FETCHED: - return Object.assign({}, state, { + return { + ...state, fetched: false, fetching: true, roomMsgs: action.payload - }); + }; case ROOM_MESSAGES_ERROR: - return Object.assign({}, state, { + return { + ...state, fetching: false, fetched: true, error: action.payload - }); + }; default: return state; } }; -export default roomChatReducer; \ No newline at end of file +export default roomChatReducer; diff --git a/client/reducers/roomReducer.js b/client/reducers/roomReducer.js index 0c70638..90fb595 100644 --- a/client/reducers/roomReducer.js +++ b/client/reducers/roomReducer.js @@ -10,27 +10,32 @@ const initialState = { const roomReducer = (state = initialState, action) => { switch(action.type) { case FETCHING_ROOMS: - return Object.assign({}, state, {fetching: true} ); + return { + ...state, + fetching: true + } case FETCHED_ROOMS: - return Object.assign({}, state, { + return { + ...state, fetching: false, fetched: true, rooms: action.payload - }); + } case FETCHED_ROOMS_ERROR: - return Object.assign({}, state, { + return { + ...state, fetching: false, fetched: true, error: action.payload - }); + }; case CHOOSE_ROOM: - return Object.assign({}, state, { + return { + ...state, chosenRoom: action.chosenRoom - }); - + }; default: return state; } }; -export default roomReducer; \ No newline at end of file +export default roomReducer; diff --git a/client/reducers/whiteboardReducer.js b/client/reducers/whiteboardReducer.js index 4e93ac1..057bb30 100644 --- a/client/reducers/whiteboardReducer.js +++ b/client/reducers/whiteboardReducer.js @@ -9,21 +9,24 @@ const initialState = { const whiteboardReducer = (state = initialState, action) => { switch (action.type) { case FETCHING_WHITEBOARD: - return Object.assign({}, state, { + return { + ...state, fetching: true - }); + } case WHITEBOARD_FETCHED: - return Object.assign({}, state, { + return { + ...state, fetching: false, fetched: true, whiteboardId: action.payload - }); + }; case WHITEBOARD_ERROR: - return Object.assign({}, state, { + return { + ...state, fetching: false, fetched: true, error: action.payload - }); + }; default: return state; } From ffa605958ccdb0309b4aa5ac9c30a87f1a944634 Mon Sep 17 00:00:00 2001 From: Patrick Truong Date: Wed, 3 Oct 2018 21:57:25 -0700 Subject: [PATCH 2/3] delete unused container --- client/containers/containers.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 client/containers/containers.js diff --git a/client/containers/containers.js b/client/containers/containers.js deleted file mode 100644 index e69de29..0000000 From cb11901af7d76c6117e01174c321374941fc0374 Mon Sep 17 00:00:00 2001 From: Patrick Truong Date: Wed, 3 Oct 2018 22:04:23 -0700 Subject: [PATCH 3/3] remove logger --- client/store/configureStore.js | 1 - 1 file changed, 1 deletion(-) diff --git a/client/store/configureStore.js b/client/store/configureStore.js index 160c743..710ff4c 100644 --- a/client/store/configureStore.js +++ b/client/store/configureStore.js @@ -1,6 +1,5 @@ import reducer from '../reducers/combine.js'; import { createStore, applyMiddleware } from 'redux'; -import logger from 'redux-logger'; import thunk from 'redux-thunk'; export default function configureStore (preloadedState) {