mirror of
https://github.com/Nezumi-2711/react-training.git
synced 2026-09-22 20:01:59 +00:00
Format code style
This commit is contained in:
@@ -36,16 +36,19 @@ const initialState: IUserRoomState = {
|
||||
|
||||
const reducer = (state: IUserRoomState, action: IAction) => {
|
||||
switch (action.type) {
|
||||
|
||||
case 'initRoom':
|
||||
return {
|
||||
...state,
|
||||
roomsAvailable: action.payload,
|
||||
};
|
||||
|
||||
case 'initUser':
|
||||
return {
|
||||
...state,
|
||||
usersAvailable: action.payload,
|
||||
};
|
||||
|
||||
case 'addUser': {
|
||||
const tempArr = state.usersAvailable;
|
||||
const itemExist = state.usersAvailable.find(
|
||||
@@ -61,6 +64,7 @@ const reducer = (state: IUserRoomState, action: IAction) => {
|
||||
usersAvailable: tempArr,
|
||||
};
|
||||
}
|
||||
|
||||
case 'updateUserName': {
|
||||
const tempArr = state.usersAvailable;
|
||||
|
||||
@@ -77,6 +81,7 @@ const reducer = (state: IUserRoomState, action: IAction) => {
|
||||
usersAvailable: tempArr,
|
||||
};
|
||||
}
|
||||
|
||||
case 'removeUser':
|
||||
return {
|
||||
...state,
|
||||
@@ -84,6 +89,7 @@ const reducer = (state: IUserRoomState, action: IAction) => {
|
||||
(item) => item.id !== action.payload[0].id
|
||||
),
|
||||
};
|
||||
|
||||
case 'addRoom': {
|
||||
const tempArr = state.roomsAvailable;
|
||||
const itemExist = state.roomsAvailable.find(
|
||||
@@ -99,6 +105,7 @@ const reducer = (state: IUserRoomState, action: IAction) => {
|
||||
roomsAvailable: tempArr,
|
||||
};
|
||||
}
|
||||
|
||||
case 'updateRoomName': {
|
||||
const tempArr = state.roomsAvailable;
|
||||
|
||||
@@ -115,6 +122,7 @@ const reducer = (state: IUserRoomState, action: IAction) => {
|
||||
roomsAvailable: tempArr,
|
||||
};
|
||||
}
|
||||
|
||||
case 'removeRoom':
|
||||
return {
|
||||
...state,
|
||||
@@ -122,6 +130,7 @@ const reducer = (state: IUserRoomState, action: IAction) => {
|
||||
(item) => item.id !== action.payload[0].id
|
||||
),
|
||||
};
|
||||
|
||||
default:
|
||||
throw new Error('Action unknown');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user