feat: auto delete message logic

This commit is contained in:
Tristan Yang
2022-12-27 21:29:41 +08:00
parent 1e9665dab2
commit bd12aa0e4d
6 changed files with 105 additions and 19 deletions
+2 -1
View File
@@ -12,6 +12,7 @@ export interface MessagePayload {
content: string;
expires_in?: number | null;
properties?: {
local_id?: number;
content_type: string;
size: number;
};
@@ -75,7 +76,7 @@ const messageSlice = createSlice({
data.thumbnail = content;
}
}
state[mid] = data;
state[mid] = { ...state[mid], ...data };
},
removeMessage(state, action: PayloadAction<number | number[]>) {
const mids = Array.isArray(action.payload) ? action.payload : [action.payload];