From ccdbd9543c8209cffc25dddd427d4a8604ed64ff Mon Sep 17 00:00:00 2001 From: Alex Junior Date: Tue, 15 Mar 2022 21:04:10 -0300 Subject: [PATCH] Chore: Migrate REST API - getRoomInfo to Typescript (#3823) * chore: add rest api return * chore: add rest api return --- app/views/DirectoryView/index.tsx | 36 ++++++++++++++++--------------- app/views/TeamChannelsView.tsx | 19 +++++++++------- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/app/views/DirectoryView/index.tsx b/app/views/DirectoryView/index.tsx index b4b0689b..73e6a45c 100644 --- a/app/views/DirectoryView/index.tsx +++ b/app/views/DirectoryView/index.tsx @@ -157,23 +157,25 @@ class DirectoryView extends React.Component { 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); - this.goRoom({ - rid: item._id, - name: item.name, - joinCodeRequired: room.joinCodeRequired, - t: item.t, - search: true - }); - } else { - this.goRoom({ - rid: item._id, - name: item.name, - t: item.t, - search: true, - teamMain: item.teamMain, - teamId: item.teamId - }); + const result = await RocketChat.getRoomInfo(item._id); + if (result.success) { + this.goRoom({ + rid: item._id, + name: item.name, + joinCodeRequired: result.room.joinCodeRequired, + t: item.t, + search: true + }); + } else { + this.goRoom({ + rid: item._id, + name: item.name, + t: item.t, + search: true, + teamMain: item.teamMain, + teamId: item.teamId + }); + } } }; diff --git a/app/views/TeamChannelsView.tsx b/app/views/TeamChannelsView.tsx index 5740f078..b8b32cdd 100644 --- a/app/views/TeamChannelsView.tsx +++ b/app/views/TeamChannelsView.tsx @@ -350,14 +350,17 @@ class TeamChannelsView extends React.Component