|
Lines 1-7
Link Here
|
| 1 |
export class SysprefAPIClient { |
1 |
export class SysprefAPIClient { |
| 2 |
constructor(HttpClient) { |
2 |
constructor(HttpClient) { |
| 3 |
this.httpClient = new HttpClient({ |
3 |
this.httpClient = new HttpClient({ |
| 4 |
baseURL: "/cgi-bin/koha/svc/config/systempreferences", |
4 |
baseURL: "", |
| 5 |
}); |
5 |
}); |
| 6 |
} |
6 |
} |
| 7 |
|
7 |
|
|
Lines 9-19
export class SysprefAPIClient {
Link Here
|
| 9 |
return { |
9 |
return { |
| 10 |
get: variable => |
10 |
get: variable => |
| 11 |
this.httpClient.get({ |
11 |
this.httpClient.get({ |
| 12 |
endpoint: "/?pref=" + variable, |
12 |
endpoint: |
|
|
13 |
"/cgi-bin/koha/svc/config/systempreferences/?pref=" + |
| 14 |
variable, |
| 15 |
}), |
| 16 |
getAll: (query, params) => |
| 17 |
this.httpClient.getAll({ |
| 18 |
endpoint: "/api/v1/sysprefs", |
| 19 |
query, |
| 20 |
params: { _order_by: "name", ...params }, |
| 21 |
headers: {}, |
| 13 |
}), |
22 |
}), |
| 14 |
update: (variable, value) => |
23 |
update: (variable, value) => |
| 15 |
this.httpClient.post({ |
24 |
this.httpClient.post({ |
| 16 |
endpoint: "", |
25 |
endpoint: "/cgi-bin/koha/svc/config/systempreferences", |
| 17 |
body: "pref_%s=%s".format( |
26 |
body: "pref_%s=%s".format( |
| 18 |
encodeURIComponent(variable), |
27 |
encodeURIComponent(variable), |
| 19 |
encodeURIComponent(value) |
28 |
encodeURIComponent(value) |
|
Lines 25-31
export class SysprefAPIClient {
Link Here
|
| 25 |
}), |
34 |
}), |
| 26 |
update_all: sysprefs => |
35 |
update_all: sysprefs => |
| 27 |
this.httpClient.post({ |
36 |
this.httpClient.post({ |
| 28 |
endpoint: "", |
37 |
endpoint: "/cgi-bin/koha/svc/config/systempreferences", |
| 29 |
body: Object.keys(sysprefs) |
38 |
body: Object.keys(sysprefs) |
| 30 |
.map(variable => |
39 |
.map(variable => |
| 31 |
sysprefs[variable].length |
40 |
sysprefs[variable].length |