Output the case number

master
Kuba Orlik 4 years ago
parent 7576df231d
commit b41abc7979

@ -52,7 +52,8 @@ export async function submit(
reason: string,
photos: Array<string>,
timestamp: Date,
contact_details: ContactDetails
contact_details: ContactDetails,
plate: string
) {
if (location.address.includes("\n")) {
throw new Error("no newlines allowed in address");
@ -74,7 +75,9 @@ export async function submit(
const [date_str, hour] = formatTimestamp(timestamp);
const body = `Samochód ${reason || ""}. Zdjęci${
const body = `Samochód ${
reason || ""
}. Numer rejestracyjny samochodu: ${plate} Zdjęci${
photos.length === 1 ? "e" : "a"
} wykonane ${date_str} o godz. ${hour} w pobliżu ul. ${
location.address
@ -178,5 +181,11 @@ export async function submit(
"--data",
`action=save&source=summary&instance=poznan_sm&x=${x}&y=${y}&lon=${x}&lat=${y}&srs=EPSG%3A2177&goto_thanks=`,
]);
console.log(response);
const matches = response.match(
/<li>Numer: <strong>([0-9]+)<\/strong><\/li>/
);
if (matches === null) {
throw new Error("Could not extract submission number");
}
return matches[1];
}

Loading…
Cancel
Save