Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default (state = INITIAL_STATE, action) => {
switch (action.type) {
case offlineActionTypes.CONNECTION_CHANGE:
if (network.isConnected != action.payload && !action.payload) {
return { ...state, isNetworkBannerVisible: true };
} else {
return { ...state, isNetworkBannerVisible: false };
}
case SET_CURRENT_USER:
return { ...state, user: action.user };
case SET_CURRENT_ROOM:
return { ...state, room: action.room };
case PUT_USER:
const current_users = [...state.users];
const users = current_users.concat(action.user);
return { ...state, users };