mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-19 20:19: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>}
|
* @returns {Promise<string>}
|
||||||
*/
|
*/
|
||||||
async getProfilePicUrl(contactId) {
|
async getProfilePicUrl(contactId) {
|
||||||
const profilePic = await this.pupPage.evaluate((contactId) => {
|
const profilePic = await this.pupPage.evaluate(async contactId => {
|
||||||
const chatWid = window.Store.WidFactory.createWid(contactId);
|
let asyncPic;
|
||||||
return window.Store.getProfilePicFull(chatWid);
|
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);
|
}, contactId);
|
||||||
|
|
||||||
return profilePic ? profilePic.eurl : undefined;
|
return profilePic ? profilePic.eurl : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user