How to avoid the member URL mismatch error

Hi guys :raised_hand_with_fingers_splayed:

Recently, the URL of the profile picture for some users has changed, not per website, but per individual users, if the structure of the URL changed from:

member.picture to member.picture .url
Here is a quick workaround that will prevent the code from causing any errors.

if (member.picture && typeof member.picture === 'string') {
    $w('#profilePic').src = member.picture;
} else if (member.picture && typeof member.picture === 'object') {
    $w('#profilePic').src = member.picture.url;
}

Hope this helps~!
Ahmad

4 Likes