-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathurl-generator.js
32 lines (28 loc) · 881 Bytes
/
url-generator.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
let UrlAssembler = require('url-assembler');
module.exports = (arguments) => {
const parameterList = [
'args[city-lund]',
'args[city-malmo]',
'args[city-helsingborg]',
'args[outside-lund]',
'args[roominhouse]',
'args[roominapartment]',
'args[roominstudent]',
'args[ownhouse]',
'args[ownapartment]',
'args[contractfirst]',
'args[contractsecond]',
'args[contractchange]'
]
const parameters = {
'action': 'get_rentad',
'args[max-rent]': 25000,
'args[min-rent]': 0,
'args[multiselect-all]': false,
};
parameterList.forEach(parameter => {
parameters[parameter] = true;
});
const urlBuilder = UrlAssembler('https://bopoolen.nu/wp-admin/admin-ajax.php').query(parameters);
return urlBuilder.toString();
}