|
|
@ -52,7 +52,8 @@ export async function submit(
|
|
|
|
reason: string,
|
|
|
|
reason: string,
|
|
|
|
photos: Array<string>,
|
|
|
|
photos: Array<string>,
|
|
|
|
timestamp: Date,
|
|
|
|
timestamp: Date,
|
|
|
|
contact_details: ContactDetails
|
|
|
|
contact_details: ContactDetails,
|
|
|
|
|
|
|
|
plate: string
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
if (location.address.includes("\n")) {
|
|
|
|
if (location.address.includes("\n")) {
|
|
|
|
throw new Error("no newlines allowed in address");
|
|
|
|
throw new Error("no newlines allowed in address");
|
|
|
@ -74,7 +75,9 @@ export async function submit(
|
|
|
|
|
|
|
|
|
|
|
|
const [date_str, hour] = formatTimestamp(timestamp);
|
|
|
|
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"
|
|
|
|
photos.length === 1 ? "e" : "a"
|
|
|
|
} wykonane ${date_str} o godz. ${hour} w pobliżu ul. ${
|
|
|
|
} wykonane ${date_str} o godz. ${hour} w pobliżu ul. ${
|
|
|
|
location.address
|
|
|
|
location.address
|
|
|
@ -178,5 +181,11 @@ export async function submit(
|
|
|
|
"--data",
|
|
|
|
"--data",
|
|
|
|
`action=save&source=summary&instance=poznan_sm&x=${x}&y=${y}&lon=${x}&lat=${y}&srs=EPSG%3A2177&goto_thanks=`,
|
|
|
|
`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];
|
|
|
|
}
|
|
|
|
}
|
|
|
|