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,23 +157,25 @@ 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);
this.goRoom({ if (result.success) {
rid: item._id, this.goRoom({
name: item.name, rid: item._id,
joinCodeRequired: room.joinCodeRequired, name: item.name,
t: item.t, joinCodeRequired: result.room.joinCodeRequired,
search: true t: item.t,
}); search: true
} else { });
this.goRoom({ } else {
rid: item._id, this.goRoom({
name: item.name, rid: item._id,
t: item.t, name: item.name,
search: true, t: item.t,
teamMain: item.teamMain, search: true,
teamId: item.teamId teamMain: item.teamMain,
}); teamId: item.teamId
});
}
} }
}; };

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);
rid: item._id, if (result.success) {
name: RocketChat.getRoomTitle(room), params = {
joinCodeRequired: room.joinCodeRequired, rid: item._id,
t: room.t, name: RocketChat.getRoomTitle(result.room),
teamId: room.teamId joinCodeRequired: result.room.joinCodeRequired,
}; t: result.room.t,
teamId: result.room.teamId
};
}
if (isMasterDetail) { if (isMasterDetail) {
navigation.pop(); navigation.pop();
} }