diff --git a/src/components/Dashboard/DashboardAusweis.svelte b/src/components/Dashboard/DashboardAusweis.svelte index 8dc23f8f..506f7da6 100644 --- a/src/components/Dashboard/DashboardAusweis.svelte +++ b/src/components/Dashboard/DashboardAusweis.svelte @@ -19,7 +19,7 @@ export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient | BedarfsausweisWohnenClient; export let aufnahme: AufnahmeKomplettClient; export let objekt: Objekt; - export let progress: number; + const progress = ausweis.ausgestellt ? 100 : ausweis.bestellt ? 66 : 33; const ausweisart = getAusweisartFromUUID(ausweis.uid); @@ -39,14 +39,25 @@ }); if (result === true) { - await api["verbrauchsausweis-wohnen"]._uid.DELETE.fetch(undefined, { - params: { - uid: ausweis.uid, - }, - headers: { - Authorization: `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`, - }, - }); + if (ausweisart === Enums.Ausweisart.VerbrauchsausweisWohnen) { + await api["verbrauchsausweis-wohnen"]._uid.DELETE.fetch(undefined, { + params: { + uid: ausweis.uid, + }, + headers: { + Authorization: `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`, + }, + }); + } else if (ausweisart === Enums.Ausweisart.VerbrauchsausweisGewerbe) { + await api["verbrauchsausweis-gewerbe"]._uid.DELETE.fetch(undefined, { + params: { + uid: ausweis.uid, + }, + headers: { + Authorization: `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`, + }, + }); + } ausweis.storniert ausweis = ausweis; @@ -138,8 +149,9 @@