diff --git a/src/astro-typesafe-api-caller.ts b/src/astro-typesafe-api-caller.ts index ca46156e..d698cf9e 100644 --- a/src/astro-typesafe-api-caller.ts +++ b/src/astro-typesafe-api-caller.ts @@ -5,6 +5,7 @@ export const createCaller = createCallerFactory({ "klimafaktoren": await import("../src/pages/api/klimafaktoren.ts"), "postleitzahlen": await import("../src/pages/api/postleitzahlen.ts"), "unterlage": await import("../src/pages/api/unterlage.ts"), + "ausweise": await import("../src/pages/api/ausweise/index.ts"), "admin/ausstellen": await import("../src/pages/api/admin/ausstellen.ts"), "admin/bestellbestaetigung": await import("../src/pages/api/admin/bestellbestaetigung.ts"), "admin/erinnern": await import("../src/pages/api/admin/erinnern.ts"), @@ -12,11 +13,10 @@ export const createCaller = createCallerFactory({ "admin/post-ausstellen": await import("../src/pages/api/admin/post-ausstellen.ts"), "admin/registriernummer": await import("../src/pages/api/admin/registriernummer.ts"), "admin/stornieren": await import("../src/pages/api/admin/stornieren.ts"), - "aufnahme": await import("../src/pages/api/aufnahme/index.ts"), - "ausweise": await import("../src/pages/api/ausweise/index.ts"), "auth/access-token": await import("../src/pages/api/auth/access-token.ts"), "auth/passwort-vergessen": await import("../src/pages/api/auth/passwort-vergessen.ts"), "auth/refresh-token": await import("../src/pages/api/auth/refresh-token.ts"), + "aufnahme": await import("../src/pages/api/aufnahme/index.ts"), "bedarfsausweis-gewerbe/[uid]": await import("../src/pages/api/bedarfsausweis-gewerbe/[uid].ts"), "bedarfsausweis-gewerbe": await import("../src/pages/api/bedarfsausweis-gewerbe/index.ts"), "bedarfsausweis-wohnen/[uid]": await import("../src/pages/api/bedarfsausweis-wohnen/[uid].ts"), diff --git a/src/components/Verbrauchsausweis/audits/KlimaFaktoren.ts b/src/components/Verbrauchsausweis/audits/KlimaFaktoren.ts index ed307f97..53884dfb 100644 --- a/src/components/Verbrauchsausweis/audits/KlimaFaktoren.ts +++ b/src/components/Verbrauchsausweis/audits/KlimaFaktoren.ts @@ -20,6 +20,11 @@ export async function auditKlimaFaktoren( ausweis.startdatum, gebaeude.plz ); + + if (response && response.length === 3) { + return false + } + return true; // Alle Klimfaktoren konnten abgefragt werden. } catch (e) { return true; diff --git a/src/lib/Klimafaktoren.ts b/src/lib/Klimafaktoren.ts index 4575c4e8..5326b948 100644 --- a/src/lib/Klimafaktoren.ts +++ b/src/lib/Klimafaktoren.ts @@ -11,11 +11,15 @@ export const getKlimafaktoren = memoize(async (date: Date, plz: string) => { const response = await api.klimafaktoren.GET.fetch({ plz, genauigkeit: "years", - startdatum: moment(date).utc(true).toDate(), - enddatum: moment(date).add(2, "years").utc(true).toDate(), + // @ts-ignore Der Adapter nimmt z.coerce.date() + startdatum: moment(date).utc(true).toString(), + // @ts-ignore Der Adapter nimmt z.coerce.date() + enddatum: moment(date).add(2, "years").utc(true).toString(), }); return response; } catch (e) { + console.log(e); + return null; } }); diff --git a/src/pages/api/klimafaktoren.ts b/src/pages/api/klimafaktoren.ts index 35a51933..bb392548 100644 --- a/src/pages/api/klimafaktoren.ts +++ b/src/pages/api/klimafaktoren.ts @@ -1,6 +1,6 @@ import { z } from "zod"; import moment from "moment"; -import { prisma } from "#lib/server/prisma"; +import { prisma } from "#lib/server/prisma.js"; import { APIError, defineApiRoute } from "astro-typesafe-api/server"; export const GET = defineApiRoute({