Skip to content

Commit

Permalink
chatapi: type tidying
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyTWF committed Jun 26, 2024
1 parent 5b5c199 commit 896f3d4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/ChatApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class ChatApi {
method: 'POST' | 'GET' | ' PUT' | 'DELETE' | 'PATCH',
body?: REQ,
): Promise<RES> {
const response = await this.realtime.request(method, url, 1.1, {}, body);
const response = await this.realtime.request<RES>(method, url, 1.1, {}, body);
if (!response.success) {
this._logger.error('ChatApi.makeAuthorisedRequest(); failed to make request', {
url,
Expand All @@ -81,8 +81,7 @@ export class ChatApi {
throw new Ably.ErrorInfo(response.errorMessage, response.errorCode, response.statusCode) as unknown as Error;
}

const [result] = response.items as RES[];
return result as RES;
return response.items[0] as RES;
}

private async makeAuthorisedPaginatedRequest<RES, REQ = undefined>(
Expand Down

0 comments on commit 896f3d4

Please sign in to comment.