First working version of lobby.
This commit is contained in:
@@ -3,11 +3,14 @@ const lobbyPeer = (state = {}, action) =>
|
||||
switch (action.type)
|
||||
{
|
||||
case 'ADD_LOBBY_PEER':
|
||||
return { peerId: action.payload.peerId };
|
||||
return { id: action.payload.peerId };
|
||||
|
||||
case 'SET_LOBBY_PEER_DISPLAY_NAME':
|
||||
return { ...state, displayName: action.payload.displayName };
|
||||
|
||||
case 'SET_LOBBY_PEER_PROMOTION_IN_PROGRESS':
|
||||
return { ...state, promotionInProgress: action.payload.flag };
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
@@ -33,12 +36,14 @@ const lobbyPeers = (state = {}, action) =>
|
||||
}
|
||||
|
||||
case 'SET_LOBBY_PEER_DISPLAY_NAME':
|
||||
case 'SET_LOBBY_PEER_PROMOTION_IN_PROGRESS':
|
||||
{
|
||||
const oldLobbyPeer = state[action.payload.peerId];
|
||||
|
||||
if (!oldLobbyPeer)
|
||||
{
|
||||
throw new Error('no Peer found');
|
||||
// Tried to update non-existant lobbyPeer. Has probably been promoted, or left.
|
||||
return state;
|
||||
}
|
||||
|
||||
return { ...state, [oldLobbyPeer.id]: lobbyPeer(oldLobbyPeer, action) };
|
||||
|
||||
@@ -3,6 +3,7 @@ import room from './room';
|
||||
import me from './me';
|
||||
import producers from './producers';
|
||||
import peers from './peers';
|
||||
import lobbyPeers from './lobbyPeers';
|
||||
import consumers from './consumers';
|
||||
import peerVolumes from './peerVolumes';
|
||||
import notifications from './notifications';
|
||||
@@ -16,6 +17,7 @@ export default combineReducers({
|
||||
me,
|
||||
producers,
|
||||
peers,
|
||||
lobbyPeers,
|
||||
consumers,
|
||||
peerVolumes,
|
||||
notifications,
|
||||
|
||||
Reference in New Issue
Block a user