16 lines
393 B
JavaScript
16 lines
393 B
JavaScript
|
const TOKEN = '';
|
||
|
|
||
|
export default function request(url, method, data = {}, token = TOKEN ) {
|
||
|
const fullURL = url.query({ 'circle-token': token }).toString();
|
||
|
let fetchParams = {
|
||
|
method,
|
||
|
headers: {
|
||
|
'Accept': 'application/json',
|
||
|
},
|
||
|
};
|
||
|
if (method !== 'GET' && method !== 'HEAD') {
|
||
|
fetchParams.body = JSON.stringify(data);
|
||
|
}
|
||
|
return fetch(fullURL, fetchParams);
|
||
|
}
|