You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
649 B
42 lines
649 B
const initialState = {};
|
|
|
|
const dataProducers = (state = initialState, action) =>
|
|
{
|
|
switch (action.type)
|
|
{
|
|
case 'SET_ROOM_STATE':
|
|
{
|
|
const roomState = action.payload.state;
|
|
|
|
if (roomState === 'closed')
|
|
return {};
|
|
else
|
|
return state;
|
|
}
|
|
|
|
case 'ADD_DATA_PRODUCER':
|
|
{
|
|
const { dataProducer } = action.payload;
|
|
|
|
return { ...state, [dataProducer.id]: dataProducer };
|
|
}
|
|
|
|
case 'REMOVE_DATA_PRODUCER':
|
|
{
|
|
const { dataProducerId } = action.payload;
|
|
const newState = { ...state };
|
|
|
|
delete newState[dataProducerId];
|
|
|
|
return newState;
|
|
}
|
|
|
|
default:
|
|
{
|
|
return state;
|
|
}
|
|
}
|
|
};
|
|
|
|
export default dataProducers;
|