Fix multiple bugs after user testing

This commit is contained in:
Pieter Vander Vennet 2020-06-28 23:33:48 +02:00
parent bcdbf6a2dd
commit 9bd37d9cde
20 changed files with 1529 additions and 77 deletions

View file

@ -76,7 +76,14 @@ export class OsmConnection {
console.log(userInfo);
data.name = userInfo.getAttribute('display_name');
data.csCount = userInfo.getElementsByTagName("changesets")[0].getAttribute("count");
data.img = userInfo.getElementsByTagName("img")[0].getAttribute("href");
data.img = undefined;
const imgEl = userInfo.getElementsByTagName("img");
if (imgEl !== undefined && imgEl[0] !== undefined) {
data.img = imgEl[0].getAttribute("href");
}
data.img = data.img ?? "./assets/osm-logo.svg";
const messages = userInfo.getElementsByTagName("messages")[0].getElementsByTagName("received")[0];
data.unreadMessages = parseInt(messages.getAttribute("unread"));
data.totalMessages = parseInt(messages.getAttribute("count"));