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
Этот коммит содержится в:
Harshil Sharma
2024-03-21 17:12:03 +05:30
коммит произвёл GitHub
родитель 959e333031
Коммит eb817966a4

Просмотреть файл

@@ -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) => { return async (dispatch, getState) => {
let updatedChannel; let response;
try { try {
updatedChannel = await Client4.convertGroupMessageToPrivateChannel(channelID, teamID, displayName, name); response = await Client4.convertGroupMessageToPrivateChannel(channelID, teamID, displayName, name);
} catch (error) { } catch (error) {
forceLogoutIfNecessary(error, dispatch, getState); forceLogoutIfNecessary(error, dispatch, getState);
dispatch(logError(error)); dispatch(logError(error));
@@ -284,7 +284,7 @@ export function convertGroupMessageToPrivateChannel(channelID: string, teamID: s
dispatch({ dispatch({
type: ChannelTypes.RECEIVED_CHANNEL, type: ChannelTypes.RECEIVED_CHANNEL,
data: updatedChannel, data: response.data,
}); });
// move the channel from direct message category to the default "channels" category // 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 {};
} }
return updatedChannel; return {
data: response.data,
};
}; };
} }