Bug 33289: Add API client class to interact with svc/config/systempreferences
On bug 30708 we will need to modify sysprefs from the UI (Vue app), it could be useful for other developments as well and so it is moved on its own bug report. Test plan: It can be tested independently of bug 30708 using the following code: const client = APIClient.sysprefs client.sysprefs .update( "CardnumberLength", "42" ) Sponsored-by: BULAC - http://www.bulac.fr/ Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
f92f967626
commit
9597b88ed2
2 changed files with 27 additions and 0 deletions
|
@ -2,10 +2,12 @@ import ERMAPIClient from "./erm-api-client";
|
||||||
import PatronAPIClient from "./patron-api-client";
|
import PatronAPIClient from "./patron-api-client";
|
||||||
import AcquisitionAPIClient from "./acquisition-api-client";
|
import AcquisitionAPIClient from "./acquisition-api-client";
|
||||||
import AVAPIClient from "./authorised-values";
|
import AVAPIClient from "./authorised-values";
|
||||||
|
import SysprefAPIClient from "./system-preferences-api-client";
|
||||||
|
|
||||||
export const APIClient = {
|
export const APIClient = {
|
||||||
erm: new ERMAPIClient(),
|
erm: new ERMAPIClient(),
|
||||||
patron: new PatronAPIClient(),
|
patron: new PatronAPIClient(),
|
||||||
acquisition: new AcquisitionAPIClient(),
|
acquisition: new AcquisitionAPIClient(),
|
||||||
authorised_values: new AVAPIClient(),
|
authorised_values: new AVAPIClient(),
|
||||||
|
sysprefs: new SysprefAPIClient(),
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
import HttpClient from "./http-client";
|
||||||
|
|
||||||
|
export class SysprefAPIClient extends HttpClient {
|
||||||
|
constructor() {
|
||||||
|
super({
|
||||||
|
baseURL: "/cgi-bin/koha/svc/config/systempreferences",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
get sysprefs() {
|
||||||
|
return {
|
||||||
|
update: (variable, value) =>
|
||||||
|
this.post({
|
||||||
|
endpoint: "",
|
||||||
|
body: "pref_%s=%s".format(variable, value),
|
||||||
|
headers: {
|
||||||
|
"Content-Type":
|
||||||
|
"application/x-www-form-urlencoded;charset=utf-8",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SysprefAPIClient;
|
Loading…
Reference in a new issue