From 6d543c28d93113bcaf0a2aea9d50d37502d85084 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Mon, 14 Mar 2022 21:43:59 -0300 Subject: [PATCH] Chore: Migrate REST API - createGroupChat to Typescript (#3885) * Chore: Migrate REST API - createGroupChat to Typescript * Update app/lib/rocketchat/services/restApi.ts Co-authored-by: Gleidson Daniel Silva * minor tweak Co-authored-by: Gleidson Daniel Silva --- app/lib/rocketchat/rocketchat.js | 7 ------- app/lib/rocketchat/services/restApi.ts | 8 ++++++++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/lib/rocketchat/rocketchat.js b/app/lib/rocketchat/rocketchat.js index 394bb4833..9857b7712 100644 --- a/app/lib/rocketchat/rocketchat.js +++ b/app/lib/rocketchat/rocketchat.js @@ -244,13 +244,6 @@ const RocketChat = { getRooms, readMessages, resendMessage, - createGroupChat() { - const { users } = reduxStore.getState().selectedUsers; - const usernames = users.map(u => u.name).join(','); - - // RC 3.1.0 - return this.post('im.create', { usernames }); - }, triggerBlockAction, triggerSubmitView, triggerCancel, diff --git a/app/lib/rocketchat/services/restApi.ts b/app/lib/rocketchat/services/restApi.ts index 981f49615..30a896a4b 100644 --- a/app/lib/rocketchat/services/restApi.ts +++ b/app/lib/rocketchat/services/restApi.ts @@ -753,6 +753,14 @@ export const useInviteToken = (token: string): any => // @ts-ignore sdk.post('useInviteToken', { token }); +export const createGroupChat = () => { + const { users } = reduxStore.getState().selectedUsers; + const usernames = users.map(u => u.name).join(','); + + // RC 3.1.0 + return sdk.post('im.create', { usernames }); +}; + export const addUsersToRoom = (rid: string): Promise => { const { users: selectedUsers } = reduxStore.getState().selectedUsers; const users = selectedUsers.map(u => u.name);