fix: bugs
This commit is contained in:
@@ -2,7 +2,7 @@ import { createApi } from "@reduxjs/toolkit/query/react";
|
||||
// import toast from "react-hot-toast";
|
||||
import baseQuery from "./base.query";
|
||||
import BASE_URL, { ContentTypes } from "../config";
|
||||
import { updateChannel, removeChannel } from "../slices/channels";
|
||||
import { updateChannel } from "../slices/channels";
|
||||
import { removeMessage } from "../slices/message";
|
||||
import { removeChannelSession } from "../slices/message.channel";
|
||||
import { removeReactionMessage } from "../slices/message.reaction";
|
||||
@@ -96,7 +96,6 @@ export const channelApi = createApi({
|
||||
const { channelMessage } = getState();
|
||||
try {
|
||||
await queryFulfilled;
|
||||
dispatch(removeChannel(id));
|
||||
// 删掉该channel下的所有消息&reaction
|
||||
const mids = channelMessage[id];
|
||||
if (mids) {
|
||||
|
||||
@@ -14,7 +14,7 @@ const channelsSlice = createSlice({
|
||||
fullfillChannels(state, action) {
|
||||
console.log("set channels store", state);
|
||||
const chs = action.payload || [];
|
||||
state.ids = chs.map(({ gid }) => gid);
|
||||
state.ids = chs.map(({ gid }) => +gid);
|
||||
state.byId = Object.fromEntries(
|
||||
chs.map((c) => {
|
||||
const { gid } = c;
|
||||
@@ -26,11 +26,16 @@ const channelsSlice = createSlice({
|
||||
addChannel(state, action) {
|
||||
// console.log("set channels store", action);
|
||||
const ch = action.payload;
|
||||
const { gid, ...rest } = ch;
|
||||
state.ids.push(gid);
|
||||
const { gid, avatar_updated_at } = ch;
|
||||
if (!state.ids.includes(+gid)) {
|
||||
state.ids.push(+gid);
|
||||
}
|
||||
state.byId[gid] = {
|
||||
...rest,
|
||||
icon: `${BASE_URL}/resource/group_avatar?gid=${gid}`,
|
||||
...ch,
|
||||
icon:
|
||||
avatar_updated_at == 0
|
||||
? ""
|
||||
: `${BASE_URL}/resource/group_avatar?gid=${gid}&t=${avatar_updated_at}`,
|
||||
};
|
||||
},
|
||||
updateChannel(state, action) {
|
||||
|
||||
@@ -17,7 +17,7 @@ const StyledInput = styled.input`
|
||||
background: #ffffff;
|
||||
border: 1px solid #e5e7eb;
|
||||
box-shadow: 0px 1px 2px rgba(31, 41, 55, 0.08);
|
||||
border-radius: var(--br);
|
||||
border-radius: 4px;
|
||||
font-weight: normal;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
|
||||
@@ -104,14 +104,14 @@ function ResourceManagement({ fileMessages }) {
|
||||
content,
|
||||
created_at,
|
||||
from_uid,
|
||||
properties: { name, file_type, size },
|
||||
properties: { name, content_type, size },
|
||||
} = data;
|
||||
return (
|
||||
<FileBox
|
||||
preview={view == Views.grid}
|
||||
flex={view == Views.item}
|
||||
key={mid}
|
||||
file_type={file_type}
|
||||
file_type={content_type}
|
||||
content={content}
|
||||
created_at={created_at}
|
||||
from_uid={from_uid}
|
||||
|
||||
Reference in New Issue
Block a user