From 637d69bb179fdf84982bd47b254d9203fcee0666 Mon Sep 17 00:00:00 2001 From: Alex Junior Date: Mon, 7 Mar 2022 12:52:22 -0300 Subject: [PATCH] chore: add rest api return (#3848) --- app/definitions/rest/v1/channels.ts | 6 ++++++ app/lib/rocketchat/services/restApi.ts | 11 ++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/definitions/rest/v1/channels.ts b/app/definitions/rest/v1/channels.ts index dfc0cd61d..8b14decb1 100644 --- a/app/definitions/rest/v1/channels.ts +++ b/app/definitions/rest/v1/channels.ts @@ -76,4 +76,10 @@ export type ChannelsEndpoints = { 'channels.removeOwner': { POST: (params: { roomId: string; userId: string }) => {}; }; + 'channels.addLeader': { + POST: (params: { roomId: string; userId: string }) => {}; + }; + 'channels.removeLeader': { + POST: (params: { roomId: string; userId: string }) => {}; + }; }; diff --git a/app/lib/rocketchat/services/restApi.ts b/app/lib/rocketchat/services/restApi.ts index 113354de9..728d30dd5 100644 --- a/app/lib/rocketchat/services/restApi.ts +++ b/app/lib/rocketchat/services/restApi.ts @@ -478,17 +478,14 @@ export const toggleRoomLeader = ({ t: SubscriptionType; userId: string; isLeader: boolean; -}): any => { +}) => { + const type = t as SubscriptionType.CHANNEL; if (isLeader) { // RC 0.58.0 - // TODO: missing definitions from server - // @ts-ignore - return sdk.post(`${roomTypeToApiType(t)}.addLeader`, { roomId, userId }); + return sdk.post(`${roomTypeToApiType(type)}.addLeader`, { roomId, userId }); } // RC 0.58.0 - // TODO: missing definitions from server - // @ts-ignore - return sdk.post(`${roomTypeToApiType(t)}.removeLeader`, { roomId, userId }); + return sdk.post(`${roomTypeToApiType(type)}.removeLeader`, { roomId, userId }); }; export const toggleRoomModerator = ({