fix(build): Types in admin-calendar, oRPC React Query Helpers in booking-status, Router-Namenskonflikt, entferne unsupported allowedHosts aus Vite
This commit is contained in:
@@ -69,8 +69,8 @@ export function AdminCalendar() {
|
||||
const startDate = new Date(firstDay);
|
||||
startDate.setDate(startDate.getDate() - firstDay.getDay());
|
||||
|
||||
const calendarDays = [];
|
||||
const currentDate = new Date(startDate);
|
||||
const calendarDays: Date[] = [];
|
||||
const currentDate: Date = new Date(startDate);
|
||||
|
||||
for (let i = 0; i < 42; i++) {
|
||||
calendarDays.push(new Date(currentDate));
|
||||
|
@@ -61,13 +61,15 @@ export default function BookingStatusPage({ token }: BookingStatusPageProps) {
|
||||
// Fetch booking details
|
||||
const { data: booking, isLoading, error, refetch } = useQuery({
|
||||
queryKey: ["booking", "status", token],
|
||||
queryFn: () => queryClient.cancellation.getBookingByToken({ token }),
|
||||
// oRPC React Query Helper liefert .queryOptions()
|
||||
...queryClient.cancellation.getBookingByToken.queryOptions({ token }),
|
||||
retry: false,
|
||||
});
|
||||
|
||||
// Cancellation mutation
|
||||
const cancelMutation = useMutation({
|
||||
mutationFn: () => queryClient.cancellation.cancelByToken({ token }),
|
||||
// oRPC React Query Helper liefert .mutationOptions()
|
||||
...queryClient.cancellation.cancelByToken.mutationOptions(),
|
||||
onSuccess: (result) => {
|
||||
setCancellationResult({
|
||||
success: true,
|
||||
@@ -90,7 +92,7 @@ export default function BookingStatusPage({ token }: BookingStatusPageProps) {
|
||||
const handleCancel = () => {
|
||||
setIsCancelling(true);
|
||||
setCancellationResult(null);
|
||||
cancelMutation.mutate();
|
||||
cancelMutation.mutate({ token });
|
||||
};
|
||||
|
||||
if (isLoading) {
|
||||
|
@@ -5,7 +5,7 @@ import { createKV } from "@/server/lib/create-kv";
|
||||
import { createKV as createAvailabilityKV } from "@/server/lib/create-kv";
|
||||
import { sendEmail, sendEmailWithAGB, sendEmailWithAGBAndCalendar, sendEmailWithInspirationPhoto } from "@/server/lib/email";
|
||||
import { renderBookingPendingHTML, renderBookingConfirmedHTML, renderBookingCancelledHTML, renderAdminBookingNotificationHTML } from "@/server/lib/email-templates";
|
||||
import { router } from "@/server/rpc";
|
||||
import { router as rootRouter } from "@/server/rpc";
|
||||
import { createORPCClient } from "@orpc/client";
|
||||
import { RPCLink } from "@orpc/client/fetch";
|
||||
import { checkBookingRateLimit, getClientIP } from "@/server/lib/rate-limiter";
|
||||
@@ -13,7 +13,7 @@ import { validateEmail } from "@/server/lib/email-validator";
|
||||
|
||||
// Create a server-side client to call other RPC endpoints
|
||||
const link = new RPCLink({ url: "http://localhost:5173/rpc" });
|
||||
const queryClient = createORPCClient<typeof router>(link);
|
||||
const queryClient = createORPCClient<typeof rootRouter>(link);
|
||||
|
||||
// Helper function to convert date from yyyy-mm-dd to dd.mm.yyyy
|
||||
function formatDateGerman(dateString: string): string {
|
||||
|
Reference in New Issue
Block a user