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

View File

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