Skip to content

Commit

Permalink
fix: Fixed clearChat method
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Oct 20, 2021
1 parent 1d1e4a1 commit 8ed1d86
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/api/layers/controls.layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,13 @@ export class ControlsLayer extends UILayer {
* @returns boolean
*/
public async clearChat(chatId: string, keepStarred = true) {
return await evaluateAndReturn(
const result = await evaluateAndReturn(
this.page,
({ chatId, keepStarred }) => WAPI.clearChat(chatId, keepStarred),
({ chatId, keepStarred }) => WPP.chat.clear(chatId, keepStarred),
{ chatId, keepStarred }
);

return result.status === 200;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/lib/wapi/functions/clear-chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ export async function clearChat(id, keepStarred) {
if (typeof keepStarred === 'undefined') {
keepStarred = true;
}
return await Store.ChatUtil.sendClear(Store.Chat.get(id), keepStarred);
const result = await WPP.chat.clear(id, keepStarred);

return result.status === 200;
}

0 comments on commit 8ed1d86

Please sign in to comment.