Verbesserungen im Prozess
This commit is contained in:
@@ -2,25 +2,25 @@
|
||||
|
||||
import AusweisLayout from "#layouts/AusweisLayoutDaten.astro";
|
||||
import BedarfsausweisWohnenModule from "#modules/BedarfsausweisWohnen/BedarfsausweisWohnenModule.svelte";
|
||||
import { AufnahmeClient, BedarfsausweisWohnenClient, ObjektClient, UploadedGebaeudeBild, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types";
|
||||
import { AufnahmeClient, ObjektClient, BildClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types";
|
||||
import { createCaller } from "src/astro-typesafe-api-caller";
|
||||
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants";
|
||||
import { validateAccessTokenServer } from "#server/lib/validateAccessToken";
|
||||
import { Enums } from "#lib/server/prisma";
|
||||
|
||||
const uid = Astro.url.searchParams.get("uid") || "";
|
||||
const uid_aufnahme = Astro.url.searchParams.get("aufnahme")
|
||||
const id = Astro.url.searchParams.get("uid") || "";
|
||||
const aufnahme_id = Astro.url.searchParams.get("aufnahme")
|
||||
const ausweistyp = Astro.url.searchParams.get("ausweistyp") || Enums.AusweisTyp.Standard;
|
||||
let ausweis: VerbrauchsausweisWohnenClient = {} as VerbrauchsausweisWohnenClient;
|
||||
let aufnahme: AufnahmeClient = {} as AufnahmeClient;
|
||||
let objekt: ObjektClient = {} as ObjektClient;
|
||||
let bilder: UploadedGebaeudeBild[] = []
|
||||
let bilder: BildClient[] = []
|
||||
|
||||
const valid = validateAccessTokenServer(Astro);
|
||||
|
||||
const caller = createCaller(Astro);
|
||||
|
||||
if (uid) {
|
||||
if (id) {
|
||||
if (!valid) {
|
||||
return Astro.redirect(
|
||||
`/auth/login?redirect=${Astro.url.toString()}`
|
||||
@@ -28,39 +28,39 @@ if (uid) {
|
||||
}
|
||||
|
||||
try {
|
||||
ausweis = await caller["bedarfsausweis-wohnen"]._uid.GET.fetch(null, {
|
||||
ausweis = await caller["bedarfsausweis-wohnen"]._id.GET.fetch(null, {
|
||||
headers: {
|
||||
authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
||||
},
|
||||
params: {
|
||||
uid
|
||||
id
|
||||
}
|
||||
});
|
||||
|
||||
aufnahme = await caller.aufnahme._uid.GET.fetch(null, {
|
||||
aufnahme = await caller.aufnahme._id.GET.fetch(null, {
|
||||
headers: {
|
||||
authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
||||
},
|
||||
params: {
|
||||
uid: ausweis.uid_aufnahme
|
||||
id: ausweis.aufnahme_id
|
||||
}
|
||||
})
|
||||
|
||||
objekt = await caller.objekt._uid.GET.fetch(null, {
|
||||
objekt = await caller.objekt._id.GET.fetch(null, {
|
||||
headers: {
|
||||
authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
||||
},
|
||||
params: {
|
||||
uid: ausweis.uid_objekt
|
||||
id: ausweis.objekt_id
|
||||
}
|
||||
})
|
||||
|
||||
bilder = await caller.aufnahme._uid.bilder.GET.fetch(null, {
|
||||
bilder = await caller.aufnahme._id.bilder.GET.fetch(null, {
|
||||
headers: {
|
||||
authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
||||
},
|
||||
params: {
|
||||
uid: ausweis.uid_aufnahme
|
||||
id: ausweis.aufnahme_id
|
||||
}
|
||||
})
|
||||
|
||||
@@ -81,5 +81,5 @@ if (uid) {
|
||||
|
||||
---
|
||||
<AusweisLayout title="Bedarfsausweis erstellen | IBCornelsen">
|
||||
<BedarfsausweisWohnenModule client:only {ausweis} {objekt} {aufnahme} {bilder} {ausweistyp} {uid}></BedarfsausweisWohnenModule>
|
||||
<BedarfsausweisWohnenModule client:only {ausweis} {objekt} {aufnahme} {bilder} {ausweistyp} {id}></BedarfsausweisWohnenModule>
|
||||
</AusweisLayout>
|
||||
Reference in New Issue
Block a user