2024-10-16
This commit is contained in:
parent
ee7c786dbd
commit
5793fcb710
72 changed files with 1586 additions and 667 deletions
|
|
@ -1,10 +1,24 @@
|
|||
import { x } from "./chunk-7BKSRZNG.C39W3Wne.js";
|
||||
import { z, N } from "./index.CeK6pfoJ.js";
|
||||
import { p as parse } from "./index.CCa5Y_L9.js";
|
||||
import { e as ENTETE_WC_NONCE } from "./api.js";
|
||||
import { p as parse } from "./index.BgFo03XT.js";
|
||||
import { f as ENTETE_WC_NONCE } from "./api.js";
|
||||
import { a as leveBadRequestError, b as leveUnauthorizedError, c as leveNotFoundError, d as leveErreur, E as ErreurInconnue } from "./erreurs.js";
|
||||
import { e as estWCError } from "./erreurs2.js";
|
||||
import "./exports.DMCTjIlP.js";
|
||||
const getBackend = (args) => fetch(
|
||||
`${args.route}?${args.searchParams}`,
|
||||
{
|
||||
credentials: "same-origin",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
[ENTETE_WC_NONCE]: args.nonce
|
||||
},
|
||||
method: "GET",
|
||||
mode: "same-origin",
|
||||
signal: AbortSignal.timeout(5e3)
|
||||
}
|
||||
);
|
||||
const postBackend = (args) => fetch(
|
||||
args.route,
|
||||
{
|
||||
|
|
@ -22,6 +36,7 @@ const postBackend = (args) => fetch(
|
|||
);
|
||||
const traiteReponseBackendWCSelonCodesHTTP = (corpsReponse, schemaReponse) => z(corpsReponse).with({ body: N.select(), status: 400 }, estWCError, leveBadRequestError).with({ body: N.select(), status: 401 }, estWCError, leveUnauthorizedError).with({ body: N.select(), status: 404 }, estWCError, leveNotFoundError).with(N._, (corpsOkInconnu) => parse(schemaReponse, corpsOkInconnu)).otherwise((e) => x(e, ErreurInconnue, leveErreur));
|
||||
export {
|
||||
getBackend as g,
|
||||
postBackend as p,
|
||||
traiteReponseBackendWCSelonCodesHTTP as t
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue