Skip to content

Instantly share code, notes, and snippets.

@bnhansn
Last active October 22, 2016 13:25
Show Gist options
  • Save bnhansn/7742fa7634646db4518b9c9bab127145 to your computer and use it in GitHub Desktop.
Save bnhansn/7742fa7634646db4518b9c9bab127145 to your computer and use it in GitHub Desktop.
const initialState = {
channel: null,
currentRoom: {},
};
export default function (state = initialState, action) {
switch (action.type) {
case 'ROOM_CONNECTED_TO_CHANNEL':
return {
...state,
channel: action.channel,
currentRoom: action.response.room,
};
case 'USER_LEFT_ROOM':
return initialState;
default:
return state;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment