Format code style

This commit is contained in:
2023-11-23 17:14:20 +07:00
parent a9693f5797
commit 8b14b01032
2 changed files with 15 additions and 4 deletions
@@ -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');
}