mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-18 03:29:14 +00:00
getProfilePicture Fix => Evaluation failed: Error: Comms::sendIq called before startComms (#1264)
* Fix: Evaluation failed: Error: Comms::sendIq called before startComms * [Requested Changes] - Only call Wap if we're not on MD & vice-versa Co-authored-by: Joaquin Touris <joaquin@192.168.1.5>
This commit is contained in:
@@ -876,11 +876,20 @@ class Client extends EventEmitter {
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
async getProfilePicUrl(contactId) {
|
||||
const profilePic = await this.pupPage.evaluate((contactId) => {
|
||||
const chatWid = window.Store.WidFactory.createWid(contactId);
|
||||
return window.Store.getProfilePicFull(chatWid);
|
||||
const profilePic = await this.pupPage.evaluate(async contactId => {
|
||||
let asyncPic;
|
||||
if (window.Store.Features.features.MD_BACKEND) {
|
||||
const chatWid = window.Store.WidFactory.createWid(contactId);
|
||||
asyncPic = await window.Store.getProfilePicFull(chatWid).catch(() => {
|
||||
return undefined;
|
||||
});
|
||||
} else {
|
||||
asyncPic = await window.Store.Wap.profilePicFind(contactId).catch(() => {
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
return asyncPic;
|
||||
}, contactId);
|
||||
|
||||
return profilePic ? profilePic.eurl : undefined;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user