@esvndev/es-react-template-chat 0.0.20 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -45808,7 +45808,10 @@ const config$2 = {
45808
45808
  };
45809
45809
  const chatApi = {
45810
45810
  getHistoryActive: (params) => requester.get(URL_API$1.GET_HISTORY_API, params, config$2),
45811
- getHistory: (params) => requester.get(URL_API$1.GET_HISTORY_API, params, config$2),
45811
+ //getHistory: (params: any) => requester.get(URL_API.GET_HISTORY_API, params, config),
45812
+ getHistory: (params) => {
45813
+ console.log('getHistory params', params);
45814
+ },
45812
45815
  getMessageByGroupCursor: (id, params) => requester.get(`${URL_API$1.GET_MESSAGE_BY_GROUP_CURSOR_API}/${id}`, params, config$2),
45813
45816
  getInfo: (params) => requester.get(URL_API$1.GET_INFO_API, params, config$2),
45814
45817
  groups: (params) => requester.post(URL_API$1.GROUP_API, params, config$2),
@@ -46000,203 +46003,188 @@ const initialState = {
46000
46003
  };
46001
46004
  const get_history = createAsyncThunk(CHAT.ACTION_TYPES.GET_HISTORY, async (params, thunkAPI) => {
46002
46005
  try {
46003
- //return await api.chatApi.getHistory(params)
46004
- return await [];
46005
- }
46006
- catch (error) {
46007
- return thunkAPI.rejectWithValue({ error: error.response.data });
46008
- }
46009
- });
46010
- createAsyncThunk(CHAT.ACTION_TYPES.GET_MESSAGE_BY_GROUP_CURSOR, async (params, thunkAPI) => {
46011
- try {
46012
- return await api.chatApi.getMessageByGroupCursor(params.chatRoomId, params);
46013
- }
46014
- catch (error) {
46015
- return thunkAPI.rejectWithValue({ error: error.response.data });
46016
- }
46017
- });
46018
- createAsyncThunk(CHAT.ACTION_TYPES.GET_HISTORY_ACTIVE, async (params, thunkAPI) => {
46019
- try {
46020
- return await api.chatApi.getHistoryActive(params);
46021
- }
46022
- catch (error) {
46023
- return thunkAPI.rejectWithValue({ error: error.response.data });
46024
- }
46025
- });
46026
- createAsyncThunk(CHAT.ACTION_TYPES.GET_INFO, async (params, thunkAPI) => {
46027
- try {
46028
- return await api.chatApi.getInfo(params);
46029
- }
46030
- catch (error) {
46031
- return thunkAPI.rejectWithValue({ error: error.response.data });
46032
- }
46033
- });
46034
- const groups = createAsyncThunk(CHAT.ACTION_TYPES.GROUP, async (params, thunkAPI) => {
46035
- try {
46036
- return await api.chatApi.groups(params);
46037
- }
46038
- catch (error) {
46039
- return thunkAPI.rejectWithValue({ error: error.response.data });
46040
- }
46041
- });
46042
- const addMemberGroup = createAsyncThunk(CHAT.ACTION_TYPES.MEMBER_GROUP, async (params, thunkAPI) => {
46043
- try {
46044
- return await api.chatApi.addMemberGroup(params);
46045
- }
46046
- catch (error) {
46047
- return thunkAPI.rejectWithValue({ error: error.response.data });
46048
- }
46049
- });
46050
- createAsyncThunk(CHAT.ACTION_TYPES.SEN_MESSAGE, async (params, thunkAPI) => {
46051
- try {
46052
- return await api.chatApi.senMessage(params.id, params.formData, params.tickerDto);
46053
- }
46054
- catch (error) {
46055
- return thunkAPI.rejectWithValue({ error: error.response.data });
46056
- }
46057
- });
46058
- createAsyncThunk(CHAT.ACTION_TYPES.DELETE_MESSAGE, async (params, thunkAPI) => {
46059
- try {
46060
- return await api.chatApi.deleteMessage(params.id, params.chatRoomId);
46061
- }
46062
- catch (error) {
46063
- return thunkAPI.rejectWithValue({ error: error.response.data });
46064
- }
46065
- });
46066
- createAsyncThunk(CHAT.ACTION_TYPES.RECALL_MESSAGE, async (params, thunkAPI) => {
46067
- try {
46068
- return await api.chatApi.recallMessage(params.id, params.chatRoomId);
46069
- }
46070
- catch (error) {
46071
- return thunkAPI.rejectWithValue({ error: error.response.data });
46072
- }
46073
- });
46074
- createAsyncThunk(CHAT.ACTION_TYPES.UPDATE_GROUP_AVATAR, async (params, thunkAPI) => {
46075
- try {
46076
- return await api.chatApi.updateGroupAvatar(params);
46077
- }
46078
- catch (error) {
46079
- return thunkAPI.rejectWithValue({ error: error.response.data });
46080
- }
46081
- });
46082
- createAsyncThunk(CHAT.ACTION_TYPES.GET_MESSAGE_BY_GROUP, async (params, thunkAPI) => {
46083
- try {
46084
- return await api.chatApi.getMessageByGroup(params.chatRoomId, params.paging);
46085
- }
46086
- catch (error) {
46087
- return thunkAPI.rejectWithValue({ error: error.response.data });
46088
- }
46089
- });
46090
- createAsyncThunk(CHAT.ACTION_TYPES.GET_MESSAGE_BY_CONTACT, async (params, thunkAPI) => {
46091
- try {
46092
- return await api.chatApi.getMessageByContact(params.chatRoomId, params.paging);
46093
- }
46094
- catch (error) {
46095
- return thunkAPI.rejectWithValue({ error: error.response.data });
46096
- }
46097
- });
46098
- const contact_add = createAsyncThunk(CHAT.ACTION_TYPES.CONTACT_ADD, async (params, thunkAPI) => {
46099
- try {
46100
- return await api.chatApi.contactAdd(params);
46101
- }
46102
- catch (error) {
46103
- return thunkAPI.rejectWithValue({ error: error.response.data });
46104
- }
46105
- });
46106
- createAsyncThunk(CHAT.ACTION_TYPES.CONNECT_CHAT_ROOM_MEMBER, async (params, thunkAPI) => {
46107
- try {
46108
- return await api.chatApi.connectChatRoomMemberApi(params);
46109
- }
46110
- catch (error) {
46111
- return thunkAPI.rejectWithValue({ error: error.response.data });
46112
- }
46113
- });
46114
- const get_profile = createAsyncThunk(CHAT.ACTION_TYPES.GET_PROFILE, async (_, thunkAPI) => {
46115
- try {
46116
- return await api.chatApi.getProfile();
46006
+ return await api.chatApi.getHistory(params);
46117
46007
  }
46118
46008
  catch (error) {
46119
46009
  return thunkAPI.rejectWithValue({ error: error.response.data });
46120
46010
  }
46121
46011
  });
46122
- createAsyncThunk(CHAT.ACTION_TYPES.GET_USERS, async (params, thunkAPI) => {
46123
- try {
46124
- return await api.chatApi.getUsers(params);
46125
- }
46126
- catch (error) {
46127
- return thunkAPI.rejectWithValue({ error: error.response.data });
46128
- }
46129
- });
46130
- const get_contact = createAsyncThunk(CHAT.ACTION_TYPES.GET_CONTACT, async (params, thunkAPI) => {
46131
- try {
46132
- return await api.chatApi.getContact(params);
46133
- }
46134
- catch (error) {
46135
- return thunkAPI.rejectWithValue({ error: error.response.data });
46136
- }
46137
- });
46138
- const update_chat_room_member = createAsyncThunk(CHAT.ACTION_TYPES.CHAT_ROOM_MEMBER, async (params, thunkAPI) => {
46139
- try {
46140
- return await api.chatApi.updateChatRoomMember(params);
46141
- }
46142
- catch (error) {
46143
- return thunkAPI.rejectWithValue({ error: error.response.data });
46144
- }
46145
- });
46146
- createAsyncThunk(CHAT.ACTION_TYPES.GET_PAGING_EMPLOYEE, async (params, thunkAPI) => {
46147
- try {
46148
- const response = await api.chatApi.getPagingEmployeeApi(params);
46149
- return response;
46150
- }
46151
- catch (error) {
46152
- return thunkAPI.rejectWithValue({ error: error.data });
46153
- }
46154
- });
46155
- createAsyncThunk(CHAT.ACTION_TYPES.PIN_MESSAGE_CHAT_ROOM, async (params, thunkAPI) => {
46156
- try {
46157
- const response = await api.chatApi.pinMessageChatRoomApi(params);
46158
- return response;
46159
- }
46160
- catch (error) {
46161
- return thunkAPI.rejectWithValue({ error: error.data });
46162
- }
46163
- });
46164
- const getPinMessageChatRoomApi = createAsyncThunk(CHAT.ACTION_TYPES.GET_PIN_MESSAGES_BY_ROOM, async (params, thunkAPI) => {
46165
- try {
46166
- const response = await api.chatApi.getPinMessagesByRoomApi(params);
46167
- return response;
46168
- }
46169
- catch (error) {
46170
- return thunkAPI.rejectWithValue({ error: error.data });
46171
- }
46172
- });
46173
- const deletePinMessageApi = createAsyncThunk(CHAT.ACTION_TYPES.DELETE_PIN_MESSAGE, async (pinId, thunkAPI) => {
46174
- try {
46175
- const response = await api.chatApi.deletePinMessageApi(pinId);
46176
- return response;
46177
- }
46178
- catch (error) {
46179
- return thunkAPI.rejectWithValue({ error: error.data });
46180
- }
46181
- });
46182
- createAsyncThunk(CHAT.ACTION_TYPES.UPDATE_GROUP_TAG, async (params, thunkAPI) => {
46183
- try {
46184
- const response = await api.chatApi.updateGroupTagApi(params);
46185
- return response;
46186
- }
46187
- catch (error) {
46188
- return thunkAPI.rejectWithValue({ error: error.response?.data || error.data });
46189
- }
46190
- });
46191
- createAsyncThunk(CHAT.ACTION_TYPES.CREATE_REMINDER, async (params, thunkAPI) => {
46192
- try {
46193
- const response = await api.chatApi.createReminderApi(params);
46194
- return response;
46195
- }
46196
- catch (error) {
46197
- return thunkAPI.rejectWithValue({ error: error.response?.data || error.data });
46198
- }
46199
- });
46012
+ // export const get_history = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.GET_HISTORY, async (params, thunkAPI) => {
46013
+ // try {
46014
+ // return await api.chatApi.getHistory(params)
46015
+ // } catch (error: any) {
46016
+ // return thunkAPI.rejectWithValue({ error: error.response.data })
46017
+ // }
46018
+ // })
46019
+ // export const get_message_by_group_cursor = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.GET_MESSAGE_BY_GROUP_CURSOR, async (params, thunkAPI) => {
46020
+ // try {
46021
+ // return await api.chatApi.getMessageByGroupCursor(params.chatRoomId, params)
46022
+ // } catch (error: any) {
46023
+ // return thunkAPI.rejectWithValue({ error: error.response.data })
46024
+ // }
46025
+ // })
46026
+ // export const get_history_active = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.GET_HISTORY_ACTIVE, async (params, thunkAPI) => {
46027
+ // try {
46028
+ // return await api.chatApi.getHistoryActive(params)
46029
+ // } catch (error: any) {
46030
+ // return thunkAPI.rejectWithValue({ error: error.response.data })
46031
+ // }
46032
+ // })
46033
+ // export const get_info = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.GET_INFO, async (params, thunkAPI) => {
46034
+ // try {
46035
+ // return await api.chatApi.getInfo(params)
46036
+ // } catch (error: any) {
46037
+ // return thunkAPI.rejectWithValue({ error: error.response.data })
46038
+ // }
46039
+ // })
46040
+ // export const groups = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.GROUP, async (params, thunkAPI) => {
46041
+ // try {
46042
+ // return await api.chatApi.groups(params)
46043
+ // } catch (error: any) {
46044
+ // return thunkAPI.rejectWithValue({ error: error.response.data })
46045
+ // }
46046
+ // })
46047
+ // export const addMemberGroup = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.MEMBER_GROUP, async (params, thunkAPI) => {
46048
+ // try {
46049
+ // return await api.chatApi.addMemberGroup(params)
46050
+ // } catch (error :any) {
46051
+ // return thunkAPI.rejectWithValue({ error: error.response.data })
46052
+ // }
46053
+ // })
46054
+ // export const sen_message = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.SEN_MESSAGE, async (params, thunkAPI) => {
46055
+ // try {
46056
+ // return await api.chatApi.senMessage(params.id, params.formData, params.tickerDto)
46057
+ // } catch (error: any) {
46058
+ // return thunkAPI.rejectWithValue({ error: error.response.data })
46059
+ // }
46060
+ // })
46061
+ // export const delete_message = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.DELETE_MESSAGE, async (params, thunkAPI) => {
46062
+ // try {
46063
+ // return await api.chatApi.deleteMessage(params.id, params.chatRoomId)
46064
+ // } catch (error: any) {
46065
+ // return thunkAPI.rejectWithValue({ error: error.response.data })
46066
+ // }
46067
+ // }
46068
+ // )
46069
+ // export const recall_message = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.RECALL_MESSAGE, async (params, thunkAPI) => {
46070
+ // try {
46071
+ // return await api.chatApi.recallMessage(params.id, params.chatRoomId)
46072
+ // } catch (error: any) {
46073
+ // return thunkAPI.rejectWithValue({ error: error.response.data })
46074
+ // }
46075
+ // }
46076
+ // )
46077
+ // export const update_group_avatar = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.UPDATE_GROUP_AVATAR, async (params, thunkAPI) => {
46078
+ // try {
46079
+ // return await api.chatApi.updateGroupAvatar(params)
46080
+ // } catch (error: any) {
46081
+ // return thunkAPI.rejectWithValue({ error: error.response.data })
46082
+ // }
46083
+ // })
46084
+ // export const get_message_by_group = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.GET_MESSAGE_BY_GROUP, async (params, thunkAPI) => {
46085
+ // try {
46086
+ // return await api.chatApi.getMessageByGroup(params.chatRoomId, params.paging)
46087
+ // } catch (error: any) {
46088
+ // return thunkAPI.rejectWithValue({ error: error.response.data })
46089
+ // }
46090
+ // })
46091
+ // export const get_message_by_contact = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.GET_MESSAGE_BY_CONTACT, async (params, thunkAPI) => {
46092
+ // try {
46093
+ // return await api.chatApi.getMessageByContact(params.chatRoomId, params.paging)
46094
+ // } catch (error: any) {
46095
+ // return thunkAPI.rejectWithValue({ error: error.response.data })
46096
+ // }
46097
+ // })
46098
+ // export const contact_add = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.CONTACT_ADD, async (params, thunkAPI) => {
46099
+ // try {
46100
+ // return await api.chatApi.contactAdd(params)
46101
+ // } catch (error: any) {
46102
+ // return thunkAPI.rejectWithValue({ error: error.response.data })
46103
+ // }
46104
+ // })
46105
+ // export const connectChatRoomMemberApi = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.CONNECT_CHAT_ROOM_MEMBER, async (params, thunkAPI) => {
46106
+ // try {
46107
+ // return await api.chatApi.connectChatRoomMemberApi(params)
46108
+ // } catch (error: any) {
46109
+ // return thunkAPI.rejectWithValue({ error: error.response.data })
46110
+ // }
46111
+ // })
46112
+ // export const get_profile = createAsyncThunk<any>(CHAT.ACTION_TYPES.GET_PROFILE, async (_: void, thunkAPI) => {
46113
+ // try {
46114
+ // return await api.chatApi.getProfile()
46115
+ // } catch (error: any) {
46116
+ // return thunkAPI.rejectWithValue({ error: error.response.data })
46117
+ // }
46118
+ // })
46119
+ // export const get_users = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.GET_USERS, async (params, thunkAPI) => {
46120
+ // try {
46121
+ // return await api.chatApi.getUsers(params)
46122
+ // } catch (error: any) {
46123
+ // return thunkAPI.rejectWithValue({ error: error.response.data })
46124
+ // }
46125
+ // })
46126
+ // export const get_contact = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.GET_CONTACT, async (params, thunkAPI) => {
46127
+ // try {
46128
+ // return await api.chatApi.getContact(params)
46129
+ // } catch (error: any) {
46130
+ // return thunkAPI.rejectWithValue({ error: error.response.data })
46131
+ // }
46132
+ // })
46133
+ // export const update_chat_room_member = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.CHAT_ROOM_MEMBER, async (params, thunkAPI) => {
46134
+ // try {
46135
+ // return await api.chatApi.updateChatRoomMember(params)
46136
+ // } catch (error: any) {
46137
+ // return thunkAPI.rejectWithValue({ error: error.response.data })
46138
+ // }
46139
+ // })
46140
+ // export const getPagingEmployeeApi = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.GET_PAGING_EMPLOYEE, async (params, thunkAPI) => {
46141
+ // try {
46142
+ // const response = await api.chatApi.getPagingEmployeeApi(params)
46143
+ // return response
46144
+ // } catch (error: any) {
46145
+ // return thunkAPI.rejectWithValue({ error: error.data })
46146
+ // }
46147
+ // })
46148
+ // export const pinMessageChatRoomApi = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.PIN_MESSAGE_CHAT_ROOM, async (params, thunkAPI) => {
46149
+ // try {
46150
+ // const response = await api.chatApi.pinMessageChatRoomApi(params)
46151
+ // return response
46152
+ // } catch (error: any) {
46153
+ // return thunkAPI.rejectWithValue({ error: error.data })
46154
+ // }
46155
+ // })
46156
+ // export const getPinMessageChatRoomApi = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.GET_PIN_MESSAGES_BY_ROOM, async (params, thunkAPI) => {
46157
+ // try {
46158
+ // const response = await api.chatApi.getPinMessagesByRoomApi(params)
46159
+ // return response
46160
+ // } catch (error: any) {
46161
+ // return thunkAPI.rejectWithValue({ error: error.data })
46162
+ // }
46163
+ // })
46164
+ // export const deletePinMessageApi = createAsyncThunk<any, string>(CHAT.ACTION_TYPES.DELETE_PIN_MESSAGE, async (pinId, thunkAPI) => {
46165
+ // try {
46166
+ // const response = await api.chatApi.deletePinMessageApi(pinId)
46167
+ // return response
46168
+ // } catch (error: any) {
46169
+ // return thunkAPI.rejectWithValue({ error: error.data })
46170
+ // }
46171
+ // })
46172
+ // export const updateGroupTagApi = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.UPDATE_GROUP_TAG, async (params, thunkAPI) => {
46173
+ // try {
46174
+ // const response = await api.chatApi.updateGroupTagApi(params)
46175
+ // return response
46176
+ // } catch (error: any) {
46177
+ // return thunkAPI.rejectWithValue({ error: error.response?.data || error.data })
46178
+ // }
46179
+ // })
46180
+ // export const createReminderApi = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.CREATE_REMINDER, async (params, thunkAPI) => {
46181
+ // try {
46182
+ // const response = await api.chatApi.createReminderApi(params)
46183
+ // return response
46184
+ // } catch (error: any) {
46185
+ // return thunkAPI.rejectWithValue({ error: error.response?.data || error.data })
46186
+ // }
46187
+ // })
46200
46188
  const appChatSlice = createSlice({
46201
46189
  name: 'appChat',
46202
46190
  initialState,
@@ -46499,59 +46487,60 @@ const appChatSlice = createSlice({
46499
46487
  }
46500
46488
  },
46501
46489
  extraReducers: builder => {
46502
- builder.addCase(contact_add.fulfilled, (state) => {
46503
- state.checkInit = !state.checkInit;
46504
- });
46505
- builder.addCase(groups.fulfilled, (state) => {
46506
- state.checkInit = true;
46507
- });
46508
- builder.addCase(groups.pending, (state) => {
46509
- state.checkInit = false;
46510
- });
46511
- builder.addCase(groups.rejected, (state) => {
46512
- state.checkInit = false;
46513
- });
46514
- builder.addCase(addMemberGroup.fulfilled, (state) => {
46515
- state.checkInit = true;
46516
- });
46517
- builder.addCase(addMemberGroup.pending, (state) => {
46518
- state.checkInit = false;
46519
- });
46520
- builder.addCase(addMemberGroup.rejected, (state) => {
46521
- state.checkInit = false;
46522
- });
46523
- builder.addCase(get_profile.fulfilled, (state, action) => {
46524
- state.userLogin = action.payload;
46525
- });
46526
- builder.addCase(get_contact.fulfilled, (state, action) => {
46527
- state.listContact = action.payload?.items;
46528
- });
46529
- builder.addCase(update_chat_room_member.fulfilled, (state) => {
46530
- state.checkInit = !state.checkInit;
46531
- });
46532
- builder.addCase(get_history.fulfilled, (state, action) => {
46533
- state.listHistory = action.payload?.items;
46534
- });
46535
- builder.addCase(getPinMessageChatRoomApi.fulfilled, (state, action) => {
46536
- // Backend trả về danh sách PinMessage (mảng / items / data)
46537
- const payload = action.payload;
46538
- if (!payload) {
46539
- state.pinnedMessages = [];
46540
- return;
46541
- }
46542
- //debugger
46543
- let records = [];
46544
- if (Array.isArray(payload)) {
46545
- records = payload;
46546
- }
46547
- state.pinnedMessages = records
46548
- .map(mapPinRecordToMessage)
46549
- .filter((x) => !!x);
46550
- });
46551
- builder.addCase(deletePinMessageApi.fulfilled, (state, action) => {
46552
- const pinId = action.meta.arg;
46553
- state.pinnedMessages = state.pinnedMessages.filter((msg) => (msg.pinId || msg.id) !== pinId);
46554
- });
46490
+ console.log('extraReducers', builder);
46491
+ // builder.addCase(contact_add.fulfilled, (state: IFState) => {
46492
+ // state.checkInit = !state.checkInit
46493
+ // })
46494
+ // builder.addCase(groups.fulfilled, (state: IFState) => {
46495
+ // state.checkInit = true
46496
+ // })
46497
+ // builder.addCase(groups.pending, (state: IFState) => {
46498
+ // state.checkInit = false
46499
+ // })
46500
+ // builder.addCase(groups.rejected, (state: IFState) => {
46501
+ // state.checkInit = false
46502
+ // })
46503
+ // builder.addCase(addMemberGroup.fulfilled, (state: IFState) => {
46504
+ // state.checkInit = true
46505
+ // })
46506
+ // builder.addCase(addMemberGroup.pending, (state: IFState) => {
46507
+ // state.checkInit = false
46508
+ // })
46509
+ // builder.addCase(addMemberGroup.rejected, (state: IFState) => {
46510
+ // state.checkInit = false
46511
+ // })
46512
+ // builder.addCase(get_profile.fulfilled, (state: IFState, action) => {
46513
+ // state.userLogin = action.payload
46514
+ // })
46515
+ // builder.addCase(get_contact.fulfilled, (state: IFState, action) => {
46516
+ // state.listContact = action.payload?.items
46517
+ // })
46518
+ // builder.addCase(update_chat_room_member.fulfilled, (state: IFState) => {
46519
+ // state.checkInit = !state.checkInit
46520
+ // })
46521
+ // builder.addCase(get_history.fulfilled, (state: IFState, action) => {
46522
+ // state.listHistory = action.payload?.items
46523
+ // })
46524
+ // builder.addCase(getPinMessageChatRoomApi.fulfilled, (state: IFState, action) => {
46525
+ // // Backend trả về danh sách PinMessage (mảng / items / data)
46526
+ // const payload = action.payload as any
46527
+ // if (!payload) {
46528
+ // state.pinnedMessages = []
46529
+ // return
46530
+ // }
46531
+ // //debugger
46532
+ // let records: any[] = []
46533
+ // if (Array.isArray(payload)) {
46534
+ // records = payload
46535
+ // }
46536
+ // state.pinnedMessages = records
46537
+ // .map(mapPinRecordToMessage)
46538
+ // .filter((x: any) => !!x)
46539
+ // })
46540
+ // builder.addCase(deletePinMessageApi.fulfilled, (state: IFState, action) => {
46541
+ // const pinId = action.meta.arg
46542
+ // state.pinnedMessages = state.pinnedMessages.filter((msg: any) => (msg.pinId || msg.id) !== pinId)
46543
+ // })
46555
46544
  // builder.addCase(selectByGroup.fulfilled, (state: any) => {
46556
46545
  // state.checkInit = !state.checkInit
46557
46546
  // })