40 lines
1.5 KiB
Plaintext
40 lines
1.5 KiB
Plaintext
---
|
|
|
|
import KundendatenModule from "#modules/KundendatenModule.svelte";
|
|
import AusweisLayout from "#layouts/AusweisLayoutPruefung.astro";
|
|
import { Enums } from "#lib/client/prisma";
|
|
import { getCurrentUser } from "#lib/server/user";
|
|
|
|
// Man sollte nur auf diese Seite kommen, wenn ein Ausweis bereits vorliegt und in der Datenbank abgespeichert wurde.
|
|
|
|
const user = await getCurrentUser(Astro) || {}
|
|
|
|
const params = new URLSearchParams(await Astro.request.text());
|
|
|
|
if (!params.has("ausweis") || !params.has("aufnahme") || !params.has("objekt") || !params.has("bilder") || !params.has("ausweisart")) {
|
|
return Astro.redirect("/404")
|
|
}
|
|
|
|
let ausweis, aufnahme, objekt, ausweisart, bilder, ausweistyp;
|
|
try {
|
|
ausweis = JSON.parse(params.get("ausweis") || "")
|
|
aufnahme = JSON.parse(params.get("aufnahme") || "")
|
|
objekt = JSON.parse(params.get("objekt") || "")
|
|
ausweisart = JSON.parse(params.get("ausweisart") || "") as Enums.Ausweisart;
|
|
bilder = JSON.parse(params.get("bilder") || "");
|
|
ausweistyp = JSON.parse(params.get("ausweistyp") || "") as Enums.AusweisTyp;
|
|
|
|
if (!ausweisart || !Object.keys(Enums.Ausweisart).includes(ausweisart) || !ausweistyp || !Object.keys(Enums.AusweisTyp).includes(ausweistyp)) {
|
|
throw new Error()
|
|
}
|
|
} catch(e){
|
|
return Astro.redirect("/404")
|
|
}
|
|
|
|
---
|
|
|
|
<AusweisLayout title="Kundendaten Aufnehmen - IBCornelsen">
|
|
<KundendatenModule {user} {ausweis} {objekt} {aufnahme} {bilder} {ausweisart} {ausweistyp} aktiveBezahlmethode={Enums.Bezahlmethoden.paypal} client:only></KundendatenModule>
|
|
</AusweisLayout>
|
|
|