Skip to content

Commit

Permalink
cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
yayuyokitano authored Nov 23, 2020
1 parent c11ea6f commit d47abd2
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/classes/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,8 @@ export default class HelperClass {
if (detailTypes !== []) {

const res = await this.fetchDetails(usernameOrSessionKey, detailTypes, artist, album, track);
console.log(res);

const exists = res.map(e => e.error === undefined);
const exists = res.map((e) => typeof e.error === "undefined");

let i = 0;

Expand Down Expand Up @@ -173,7 +172,7 @@ export default class HelperClass {
nowplaying
},
details
}
};

}

Expand Down Expand Up @@ -206,13 +205,13 @@ export default class HelperClass {
let promises:Promise<any>[] = [];

if (detailTypes?.includes("artist")) {
promises.push(this.lastfm.artist.getInfo({artist}, {username: usernameOrSessionKey}).catch(err => {}));
promises.push(this.lastfm.artist.getInfo({artist}, {username: usernameOrSessionKey}).catch((err) => {}));
}
if (detailTypes?.includes("album") && album) {
promises.push(this.lastfm.album.getInfo({artist, album}, {username: usernameOrSessionKey}).catch(err => {}));
promises.push(this.lastfm.album.getInfo({artist, album}, {username: usernameOrSessionKey}).catch((err) => {}));
}
if (detailTypes?.includes("track")) {
promises.push(this.lastfm.track.getInfo({artist, track}, {username: usernameOrSessionKey}).catch(err => {}));
promises.push(this.lastfm.track.getInfo({artist, track}, {username: usernameOrSessionKey}).catch((err) => {}));
}

return await Promise.all(promises);
Expand Down

0 comments on commit d47abd2

Please sign in to comment.