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

const initialState = {};
const dataConsumers = (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_CONSUMER':
{
const { dataConsumer } = action.payload;
return { ...state, [dataConsumer.id]: dataConsumer };
}
case 'REMOVE_DATA_CONSUMER':
{
const { dataConsumerId } = action.payload;
const newState = { ...state };
delete newState[dataConsumerId];
return newState;
}
default:
{
return state;
}
}
};
export default dataConsumers;