Jonathan Druart
37a16e69c7
And tidy them Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
52 lines
1.8 KiB
JavaScript
52 lines
1.8 KiB
JavaScript
/* keep tidy */
|
|
import HttpClient from "./http-client.js";
|
|
|
|
export class LocalizationAPIClient extends HttpClient {
|
|
constructor() {
|
|
super({
|
|
baseURL: "/cgi-bin/koha/svc/localization",
|
|
});
|
|
}
|
|
|
|
get localizations() {
|
|
return {
|
|
create: localization =>
|
|
this.post({
|
|
endpoint: "",
|
|
body: "entity=%s&code=%s&lang=%s&translation=%s".format(
|
|
encodeURIComponent(localization.entity),
|
|
encodeURIComponent(localization.code),
|
|
encodeURIComponent(localization.lang),
|
|
encodeURIComponent(localization.translation)
|
|
),
|
|
headers: {
|
|
"Content-Type":
|
|
"application/x-www-form-urlencoded;charset=utf-8",
|
|
},
|
|
}),
|
|
update: localization =>
|
|
this.put({
|
|
endpoint: "",
|
|
body: "id=%s&lang=%s&translation=%s".format(
|
|
encodeURIComponent(localization.id),
|
|
encodeURIComponent(localization.lang),
|
|
encodeURIComponent(localization.translation)
|
|
),
|
|
headers: {
|
|
"Content-Type":
|
|
"application/x-www-form-urlencoded;charset=utf-8",
|
|
},
|
|
}),
|
|
delete: id =>
|
|
this.delete({
|
|
endpoint: "/?id=%s".format(id),
|
|
headers: {
|
|
"Content-Type":
|
|
"application/x-www-form-urlencoded;charset=utf-8",
|
|
},
|
|
}),
|
|
};
|
|
}
|
|
}
|
|
|
|
export default LocalizationAPIClient;
|