ampache_react/app/utils/url.js

14 lines
400 B
JavaScript
Raw Normal View History

2016-07-07 23:23:18 +02:00
export function assembleURLAndParams (endpoint, params) {
var url = endpoint + "?";
Object.keys(params).forEach(
key => {
if (Array.isArray(params[key])) {
params[key].forEach(value => url += key + "[]=" + value + "&");
} else {
url += key + "=" + params[key] + "&";
}
}
);
return url.rstrip("&");
}