mirror of
https://github.com/Nezumi-2711/react-training.git
synced 2026-09-22 20:01:59 +00:00
Fix comments
This commit is contained in:
@@ -16,7 +16,9 @@ type TAction =
|
||||
| 'addUser'
|
||||
| 'updateStatusUser'
|
||||
| 'updateUserName'
|
||||
| 'updateRoomName';
|
||||
| 'updateRoomName'
|
||||
| 'removeUser'
|
||||
| 'removeRoom';
|
||||
|
||||
interface IAction {
|
||||
type: TAction;
|
||||
@@ -96,6 +98,12 @@ const reducer = (state: IUserRoomState, action: IAction) => {
|
||||
};
|
||||
}
|
||||
|
||||
case 'removeUser':
|
||||
return {
|
||||
...state,
|
||||
usersAvailable: state.usersAvailable.filter((user) => user.id !== action.payload[0].id)
|
||||
}
|
||||
|
||||
case 'addRoom': {
|
||||
const tempArr = state.roomsAvailable;
|
||||
const itemExist = state.roomsAvailable.find(
|
||||
@@ -142,6 +150,12 @@ const reducer = (state: IUserRoomState, action: IAction) => {
|
||||
};
|
||||
}
|
||||
|
||||
case 'removeRoom':
|
||||
return {
|
||||
...state,
|
||||
roomsAvailable: state.roomsAvailable.filter((room) => room.id !== action.payload[0].id)
|
||||
}
|
||||
|
||||
default:
|
||||
throw new Error('Action unknown');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user