feat: leave channel

This commit is contained in:
zerosoul
2022-05-16 23:14:04 +08:00
parent d2c06d69b8
commit 4f6aad0406
12 changed files with 450 additions and 179 deletions
-4
View File
@@ -40,7 +40,6 @@ const channelsSlice = createSlice({
},
updateChannel(state, action) {
const ignoreInPublic = ["add_member", "remove_member"];
// console.log("set channels store", action);
const { id, operation, members = [], ...rest } = action.payload;
const currChannel = state.byId[id];
if (
@@ -48,7 +47,6 @@ const channelsSlice = createSlice({
(currChannel.is_public && ignoreInPublic.includes(operation))
)
return;
switch (operation) {
case "remove_member":
{
@@ -71,9 +69,7 @@ const channelsSlice = createSlice({
console.log("add member to channel", [..._set]);
state.byId[id].members = [..._set];
}
break;
default:
state.byId[id] = { ...state.byId[id], ...rest };
break;