2016-07-07 23:23:18 +02:00
|
|
|
export function assembleURLAndParams (endpoint, params) {
|
2016-08-05 00:00:25 +02:00
|
|
|
let url = endpoint + "?";
|
2016-07-07 23:23:18 +02:00
|
|
|
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("&");
|
|
|
|
}
|