Passed actual channel data to action instead of HTTP response (#26315)

* Passed actual channel data to action instead of HTTP response

* Fixed type

* Fixed type
This commit is contained in:
Harshil Sharma 2024-03-21 17:12:03 +05:30 committed by GitHub
parent 959e333031
commit eb817966a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -271,11 +271,11 @@ export function updateChannelPrivacy(channelId: string, privacy: string): Action
});
}
export function convertGroupMessageToPrivateChannel(channelID: string, teamID: string, displayName: string, name: string): ActionFuncAsync {
export function convertGroupMessageToPrivateChannel(channelID: string, teamID: string, displayName: string, name: string): ActionFuncAsync<Channel> {
return async (dispatch, getState) => {
let updatedChannel;
let response;
try {
updatedChannel = await Client4.convertGroupMessageToPrivateChannel(channelID, teamID, displayName, name);
response = await Client4.convertGroupMessageToPrivateChannel(channelID, teamID, displayName, name);
} catch (error) {
forceLogoutIfNecessary(error, dispatch, getState);
dispatch(logError(error));
@ -284,7 +284,7 @@ export function convertGroupMessageToPrivateChannel(channelID: string, teamID: s
dispatch({
type: ChannelTypes.RECEIVED_CHANNEL,
data: updatedChannel,
data: response.data,
});
// move the channel from direct message category to the default "channels" category
@ -293,7 +293,9 @@ export function convertGroupMessageToPrivateChannel(channelID: string, teamID: s
return {};
}
return updatedChannel;
return {
data: response.data,
};
};
}