Bug 36374: Keep tidy files from 'fetch' directory
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>
This commit is contained in:
parent
eb498f636e
commit
37a16e69c7
|
|
@ -1,3 +1,4 @@
|
|||
/* keep tidy */
|
||||
import ArticleRequestAPIClient from "./article-request-api-client.js";
|
||||
import AVAPIClient from "./authorised-value-api-client.js";
|
||||
import CataloguingAPIClient from "./cataloguing-api-client.js";
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* keep tidy */
|
||||
import HttpClient from "./http-client.js";
|
||||
|
||||
export class ArticleRequestAPIClient extends HttpClient {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* keep tidy */
|
||||
import HttpClient from "./http-client.js";
|
||||
|
||||
export class AVAPIClient extends HttpClient {
|
||||
|
|
@ -20,7 +21,7 @@ export class AVAPIClient extends HttpClient {
|
|||
encodeURIComponent(value.category),
|
||||
encodeURIComponent(value.value),
|
||||
encodeURIComponent(value.description),
|
||||
encodeURIComponent(value.opac_description),
|
||||
encodeURIComponent(value.opac_description)
|
||||
),
|
||||
}),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* keep tidy */
|
||||
import HttpClient from "./http-client.js";
|
||||
|
||||
export class CataloguingAPIClient extends HttpClient {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* keep tidy */
|
||||
import HttpClient from "./http-client.js";
|
||||
|
||||
export class CirculationAPIClient extends HttpClient {
|
||||
|
|
@ -32,7 +33,12 @@ export class CirculationAPIClient extends HttpClient {
|
|||
renew: checkout =>
|
||||
this.post({
|
||||
endpoint: "renew",
|
||||
body: "itemnumber=%s&borrowernumber=%s&branchcode=%s&override_limit=%s".format(checkout.item_id, checkout.patron_id, checkout.library_id, checkout.override_limit),
|
||||
body: "itemnumber=%s&borrowernumber=%s&branchcode=%s&override_limit=%s".format(
|
||||
checkout.item_id,
|
||||
checkout.patron_id,
|
||||
checkout.library_id,
|
||||
checkout.override_limit
|
||||
),
|
||||
//+ ( checkout.seen !== undefined ? "&seen=%s".format(checkout.seen) : "" ) + (checkout.date_due !== undefined ? "&date_due=%s".format(checkout.date_due) : ""),
|
||||
headers: {
|
||||
"Content-Type":
|
||||
|
|
@ -51,13 +57,16 @@ export class CirculationAPIClient extends HttpClient {
|
|||
mark_as_not_seen: checkout_id =>
|
||||
this.post({
|
||||
endpoint: "checkout_notes",
|
||||
body: "issue_id=%s&op=%s".format(checkout_id, "cud-notseen"),
|
||||
body: "issue_id=%s&op=%s".format(
|
||||
checkout_id,
|
||||
"cud-notseen"
|
||||
),
|
||||
headers: {
|
||||
"Content-Type":
|
||||
"application/x-www-form-urlencoded;charset=utf-8",
|
||||
},
|
||||
})
|
||||
}
|
||||
}),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* keep tidy */
|
||||
import HttpClient from "./http-client.js";
|
||||
|
||||
export class ClubAPIClient extends HttpClient {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* keep tidy */
|
||||
import HttpClient from "./http-client.js";
|
||||
|
||||
export class CoverImageAPIClient extends HttpClient {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* keep tidy */
|
||||
class Dialog {
|
||||
constructor(options = {}) {}
|
||||
|
||||
|
|
@ -17,9 +18,10 @@ class Dialog {
|
|||
class HttpClient {
|
||||
constructor(options = {}) {
|
||||
this._baseURL = options.baseURL || "";
|
||||
this._headers = options.headers || { // FIXME we actually need to merge the headers
|
||||
this._headers = options.headers || {
|
||||
// FIXME we actually need to merge the headers
|
||||
"Content-Type": "application/json;charset=utf-8",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
"X-Requested-With": "XMLHttpRequest",
|
||||
};
|
||||
this.csrf_token = $('meta[name="csrf-token"]').attr("content");
|
||||
}
|
||||
|
|
@ -38,7 +40,9 @@ class HttpClient {
|
|||
headers: { ...this._headers, ...headers },
|
||||
})
|
||||
.then(response => {
|
||||
const is_json = response.headers.get("content-type")?.includes("application/json");
|
||||
const is_json = response.headers
|
||||
.get("content-type")
|
||||
?.includes("application/json");
|
||||
if (!response.ok) {
|
||||
return response.text().then(text => {
|
||||
let message;
|
||||
|
|
@ -54,7 +58,7 @@ class HttpClient {
|
|||
throw new Error(message);
|
||||
});
|
||||
}
|
||||
if ( return_response || !is_json ) {
|
||||
if (return_response || !is_json) {
|
||||
return response;
|
||||
}
|
||||
return response.json();
|
||||
|
|
@ -133,7 +137,6 @@ class HttpClient {
|
|||
true
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default HttpClient;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* keep tidy */
|
||||
import HttpClient from "./http-client.js";
|
||||
|
||||
export class LocalizationAPIClient extends HttpClient {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* keep tidy */
|
||||
import HttpClient from "./http-client.js";
|
||||
|
||||
export class PatronAPIClient extends HttpClient {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* keep tidy */
|
||||
import HttpClient from "./http-client.js";
|
||||
|
||||
export class RecallAPIClient extends HttpClient {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* keep tidy */
|
||||
import HttpClient from "./http-client.js";
|
||||
|
||||
export class SysprefAPIClient extends HttpClient {
|
||||
|
|
@ -32,7 +33,10 @@ export class SysprefAPIClient extends HttpClient {
|
|||
.map(variable =>
|
||||
sysprefs[variable].length
|
||||
? sysprefs[variable].map(value =>
|
||||
"%s=%s".format(variable, encodeURIComponent(value))
|
||||
"%s=%s".format(
|
||||
variable,
|
||||
encodeURIComponent(value)
|
||||
)
|
||||
)
|
||||
: "%s=".format(variable)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* keep tidy */
|
||||
import HttpClient from "./http-client.js";
|
||||
|
||||
export class TicketAPIClient extends HttpClient {
|
||||
|
|
@ -7,7 +8,7 @@ export class TicketAPIClient extends HttpClient {
|
|||
});
|
||||
}
|
||||
|
||||
get tickets () {
|
||||
get tickets() {
|
||||
return {
|
||||
mark_as_viewed: ticket_id =>
|
||||
this.post({
|
||||
|
|
@ -36,7 +37,7 @@ export class TicketAPIClient extends HttpClient {
|
|||
"application/x-www-form-urlencoded;charset=utf-8",
|
||||
},
|
||||
}),
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue