1
Fork 0

Add debug logs for API calls.

This commit is contained in:
Bauke 2022-02-09 16:04:34 +01:00
parent 9f0f5a46b7
commit 2a4f6f2c48
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
2 changed files with 6 additions and 0 deletions

View File

@ -1,3 +1,4 @@
import {debug} from './debug.js';
import RelationLink from './relation-link.js'; import RelationLink from './relation-link.js';
type ApiReleaseData = { type ApiReleaseData = {
@ -43,6 +44,7 @@ export default class Release {
} }
const data = (await apiResponse.json()) as ApiReleaseData; const data = (await apiResponse.json()) as ApiReleaseData;
debug(data);
const artist = data['artist-credit'] const artist = data['artist-credit']
.map(({name, joinphrase}) => `${name}${joinphrase}`) .map(({name, joinphrase}) => `${name}${joinphrase}`)

View File

@ -1,3 +1,5 @@
import {debug} from './debug.js';
type ApiSearchData = { type ApiSearchData = {
releases: Array<{ releases: Array<{
'artist-credit': Array<{ 'artist-credit': Array<{
@ -41,6 +43,8 @@ export default async function searchReleases(
} }
const data = (await response.json()) as ApiSearchData; const data = (await response.json()) as ApiSearchData;
debug(data);
const results: SearchResult[] = []; const results: SearchResult[] = [];
for (const release of data.releases) { for (const release of data.releases) {