import { ROOM } from '../actions/actionsTypes';
const initialState = {
rid: null,
isDeleting: false,
rooms: []
};
export default function(state = initialState, action) {
switch (action.type) {
case ROOM.SUBSCRIBE:
return {
...state,
rooms: [action.rid, ...state.rooms]
case ROOM.UNSUBSCRIBE:
rooms: state.rooms
.filter(rid => rid !== action.rid)
case ROOM.LEAVE:
rid: action.room.rid,
isDeleting: true
case ROOM.DELETE:
rid: action.rid,
case ROOM.CLOSE:
case ROOM.FORWARD:
case ROOM.REMOVED:
isDeleting: false
default:
return state;
}