update mapado event working

This commit is contained in:
isUnknown 2024-08-28 08:46:00 +02:00
parent 4cd3bfba57
commit c98d5eb36b
8 changed files with 184 additions and 126 deletions

View file

@ -13,6 +13,33 @@ function getDatesInMonth(month) {
return dates;
}
async function getMapadoEvent(id) {
const requestEndPoint = "ticketings/" + id;
const requestParams = [];
const requestFields = [
{ name: "startDate" },
{ name: "bookableStock" },
{
name: "eventDateList",
subfields: [{ name: "@id" }, { name: "bookableStock" }],
},
];
const requestOptions = {
method: "POST",
body: JSON.stringify({ requestEndPoint, requestParams, requestFields }),
};
const response = await fetch("/mapado-api.json", requestOptions);
const json = await response.json();
const event = json["hydra:member"];
console.log(`Événement Mapado`, event);
}
async function getMapadoDates(monthNumb) {
const contractId = "1941";
@ -129,3 +156,20 @@ async function getMergedDates(monthNumb, dates) {
const json = await response.json();
return json;
}
async function updateMapadoEvent(pageUri) {
const headers = new Headers();
const requestOptions = {
method: "POST",
headers: headers,
redirect: "follow",
body: JSON.stringify({
pageUri,
}),
};
const response = await fetch("/update-mapado-event.json", requestOptions);
const json = await response.json();
return json;
}