From f20ff5d6eccbcfd89ea0a38d7ecd2407c7e597ce Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Tue, 15 Aug 2023 16:32:20 -0700 Subject: [PATCH] chore: consistent syntax for data access --- src/_data/albums.js | 2 +- src/_data/artists.js | 2 +- src/_data/links.js | 2 +- src/_data/webmentions.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/_data/albums.js b/src/_data/albums.js index b5f239f1..af4db256 100644 --- a/src/_data/albums.js +++ b/src/_data/albums.js @@ -9,7 +9,7 @@ module.exports = async function () { type: 'json', }).catch() const data = await res - return data['topalbums'].album.map((album) => { + return data['topalbums']['album'].map((album) => { return { title: album['name'], artist: album['artist']['name'], diff --git a/src/_data/artists.js b/src/_data/artists.js index 0734236e..926d1346 100644 --- a/src/_data/artists.js +++ b/src/_data/artists.js @@ -8,7 +8,7 @@ module.exports = async function () { type: 'json', }).catch() const data = await res - return data['topartists'].artist.map((artist) => { + return data['topartists']['artist'].map((artist) => { return { title: artist['name'], plays: artist['playcount'], diff --git a/src/_data/links.js b/src/_data/links.js index 1a7331f6..34b610c1 100644 --- a/src/_data/links.js +++ b/src/_data/links.js @@ -10,7 +10,7 @@ module.exports = async function () { fetchOptions: { headers }, }) const data = await res - const links = data.results.filter((result) => Object.keys(result.tags).includes('share')) + const links = data['results'].filter((result) => Object.keys(result.tags).includes('share')) return links.map((link) => { return { title: link['title'], diff --git a/src/_data/webmentions.js b/src/_data/webmentions.js index 274296f7..e1849da7 100644 --- a/src/_data/webmentions.js +++ b/src/_data/webmentions.js @@ -9,6 +9,6 @@ module.exports = async function () { }).catch() const webmentions = await res return { - mentions: webmentions.children, + mentions: webmentions['children'], } }