projet
This commit is contained in:
20
services/discogsService.js
Normal file
20
services/discogsService.js
Normal file
@@ -0,0 +1,20 @@
|
||||
const baseUrlsearch = 'https://api.discogs.com/database/search';
|
||||
const baseUrlrelease = 'https://api.discogs.com/releases/';
|
||||
const key = 'NWmMhlPAbPlVnaDqVGyX';
|
||||
const secret = 'hZPaoBiGiSwlCjARrbOICOpDuITwyJAm';
|
||||
const perPage = 100;
|
||||
|
||||
export async function discogsearch(query, type) {
|
||||
const url = `${baseUrlsearch}?q=${query}&type=${type}&per_page=${perPage}&key=${key}&secret=${secret}`;
|
||||
const response = await fetch(url);
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
|
||||
export async function getReleaseDetails(releaseId) {
|
||||
const response = await fetch(`${baseUrlrelease}${releaseId}`);
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
window.getReleaseDetails = getReleaseDetails;
|
||||
window.discogsearch = discogsearch;
|
||||
Reference in New Issue
Block a user