Chore: Migrate REST API - getRoomInfo to Typescript (#3823)

* chore: add rest api return

* chore: add rest api return
This commit is contained in:
Alex Junior 2022-03-15 21:04:10 -03:00 committed by GitHub
parent 1aab65ef92
commit ccdbd9543c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 25 deletions

View File

@ -157,11 +157,12 @@ class DirectoryView extends React.Component<IDirectoryViewProps, any> {
this.goRoom({ rid: result.room._id, name: item.username, t: 'd' });
}
} else if (['p', 'c'].includes(item.t) && !item.teamMain) {
const { room }: any = await RocketChat.getRoomInfo(item._id);
const result = await RocketChat.getRoomInfo(item._id);
if (result.success) {
this.goRoom({
rid: item._id,
name: item.name,
joinCodeRequired: room.joinCodeRequired,
joinCodeRequired: result.room.joinCodeRequired,
t: item.t,
search: true
});
@ -175,6 +176,7 @@ class DirectoryView extends React.Component<IDirectoryViewProps, any> {
teamId: item.teamId
});
}
}
};
renderHeader = () => {

View File

@ -350,14 +350,17 @@ class TeamChannelsView extends React.Component<ITeamChannelsViewProps, ITeamChan
logEvent(events.TC_GO_ROOM);
const { navigation, isMasterDetail } = this.props;
try {
const { room } = (await RocketChat.getRoomInfo(item._id)) as any;
const params = {
let params = {};
const result = await RocketChat.getRoomInfo(item._id);
if (result.success) {
params = {
rid: item._id,
name: RocketChat.getRoomTitle(room),
joinCodeRequired: room.joinCodeRequired,
t: room.t,
teamId: room.teamId
name: RocketChat.getRoomTitle(result.room),
joinCodeRequired: result.room.joinCodeRequired,
t: result.room.t,
teamId: result.room.teamId
};
}
if (isMasterDetail) {
navigation.pop();
}