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 <gleidson10daniel@hotmail.com>

* minor tweak

Co-authored-by: Gleidson Daniel Silva <gleidson10daniel@hotmail.com>
This commit is contained in:
Reinaldo Neto 2022-03-14 21:43:59 -03:00 committed by GitHub
parent de8a7f1ce0
commit 6d543c28d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -244,13 +244,6 @@ const RocketChat = {
getRooms, getRooms,
readMessages, readMessages,
resendMessage, 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, triggerBlockAction,
triggerSubmitView, triggerSubmitView,
triggerCancel, triggerCancel,

View File

@ -753,6 +753,14 @@ export const useInviteToken = (token: string): any =>
// @ts-ignore // @ts-ignore
sdk.post('useInviteToken', { token }); 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<boolean> => { export const addUsersToRoom = (rid: string): Promise<boolean> => {
const { users: selectedUsers } = reduxStore.getState().selectedUsers; const { users: selectedUsers } = reduxStore.getState().selectedUsers;
const users = selectedUsers.map(u => u.name); const users = selectedUsers.map(u => u.name);