From a7ecc1e4275cf7bc25ec012cdf0f3205b79e1fd8 Mon Sep 17 00:00:00 2001 From: Gleidson Daniel Silva Date: Fri, 4 Mar 2022 10:38:05 -0300 Subject: [PATCH] Chore: Migrate REST API - toggleRead to Typescript (#3820) --- app/definitions/rest/v1/subscriptions.ts | 5 ++++- app/lib/rocketchat/services/restApi.ts | 6 +----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/definitions/rest/v1/subscriptions.ts b/app/definitions/rest/v1/subscriptions.ts index c05e25cf2..d02c81099 100644 --- a/app/definitions/rest/v1/subscriptions.ts +++ b/app/definitions/rest/v1/subscriptions.ts @@ -1,5 +1,8 @@ export type SubscriptionsEndpoints = { 'subscriptions.unread': { - POST: (params: { firstUnreadMessage: { _id: string } }) => {}; + POST: (params: { firstUnreadMessage: { _id: string } } | { roomId: string }) => {}; + }; + 'subscriptions.read': { + POST: (params: { rid: string }) => {}; }; }; diff --git a/app/lib/rocketchat/services/restApi.ts b/app/lib/rocketchat/services/restApi.ts index 0e2a27d01..e987f7201 100644 --- a/app/lib/rocketchat/services/restApi.ts +++ b/app/lib/rocketchat/services/restApi.ts @@ -295,14 +295,10 @@ export const setReaction = (emoji: string, messageId: string): any => // @ts-ignore sdk.post('chat.react', { emoji, messageId }); -export const toggleRead = (read: boolean, roomId: string): any => { +export const toggleRead = (read: boolean, roomId: string) => { if (read) { - // TODO: missing definitions from server - // @ts-ignore return sdk.post('subscriptions.unread', { roomId }); } - // TODO: missing definitions from server - // @ts-ignore return sdk.post('subscriptions.read', { rid: roomId }); };