From 518ad5f64e99fd51d599c136086b23ca5fb209f3 Mon Sep 17 00:00:00 2001 From: Alex Junior Date: Mon, 7 Mar 2022 12:40:38 -0300 Subject: [PATCH] chore: add rest api return (#3847) --- 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 2b5dd5f2..dfc0cd61 100644 --- a/app/definitions/rest/v1/channels.ts +++ b/app/definitions/rest/v1/channels.ts @@ -70,4 +70,10 @@ export type ChannelsEndpoints = { 'channels.removeModerator': { POST: (params: { roomId: string; userId: string }) => {}; }; + 'channels.addOwner': { + POST: (params: { roomId: string; userId: string }) => {}; + }; + 'channels.removeOwner': { + POST: (params: { roomId: string; userId: string }) => {}; + }; }; diff --git a/app/lib/rocketchat/services/restApi.ts b/app/lib/rocketchat/services/restApi.ts index 089ea8dc..113354de 100644 --- a/app/lib/rocketchat/services/restApi.ts +++ b/app/lib/rocketchat/services/restApi.ts @@ -458,17 +458,14 @@ export const toggleRoomOwner = ({ t: SubscriptionType; userId: string; isOwner: boolean; -}): any => { +}) => { + const type = t as SubscriptionType.CHANNEL; if (isOwner) { // RC 0.49.4 - // TODO: missing definitions from server - // @ts-ignore - return sdk.post(`${roomTypeToApiType(t)}.addOwner`, { roomId, userId }); + return sdk.post(`${roomTypeToApiType(type)}.addOwner`, { roomId, userId }); } // RC 0.49.4 - // TODO: missing definitions from server - // @ts-ignore - return sdk.post(`${roomTypeToApiType(t)}.removeOwner`, { roomId, userId }); + return sdk.post(`${roomTypeToApiType(type)}.removeOwner`, { roomId, userId }); }; export const toggleRoomLeader = ({