From db3a5fcd8edaa45ef05a6250e7f9452f0ed87250 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 2 Jul 2017 22:49:26 +0200 Subject: resample to 16bit 44100hz aiff --- client/client.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'client/client.js') diff --git a/client/client.js b/client/client.js index 451358e..ee50373 100644 --- a/client/client.js +++ b/client/client.js @@ -1,10 +1,17 @@ -function _get(data) { +function _get_url(_url, data) { + const url = new URL(document.origin + _url) + console.log(_url, data, document.origin) + if (data) { + Object.keys(data).forEach(key => url.searchParams.append(key, data[key])) + } + return url +} +function _get_headers() { return { method: 'GET', headers: { 'Accept': 'application/json', }, - query: data, } } function post(data) { @@ -53,7 +60,7 @@ function crud(type_s) { const type = '/' + type_s + 's/' return { index: (data) => { - return fetch(type, _get(data)) + return fetch(_get_url(type, data), _get_headers()) .then(req => req.json()) .catch(error) }, -- cgit v1.2.3-70-g09d2