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);
|
const startDate = new Date(firstDay);
|
||||||
startDate.setDate(startDate.getDate() - firstDay.getDay());
|
startDate.setDate(startDate.getDate() - firstDay.getDay());
|
||||||
|
|
||||||
const calendarDays = [];
|
const calendarDays: Date[] = [];
|
||||||
const currentDate = new Date(startDate);
|
const currentDate: Date = new Date(startDate);
|
||||||
|
|
||||||
for (let i = 0; i < 42; i++) {
|
for (let i = 0; i < 42; i++) {
|
||||||
calendarDays.push(new Date(currentDate));
|
calendarDays.push(new Date(currentDate));
|
||||||
|
@@ -61,13 +61,15 @@ export default function BookingStatusPage({ token }: BookingStatusPageProps) {
|
|||||||
// Fetch booking details
|
// Fetch booking details
|
||||||
const { data: booking, isLoading, error, refetch } = useQuery({
|
const { data: booking, isLoading, error, refetch } = useQuery({
|
||||||
queryKey: ["booking", "status", token],
|
queryKey: ["booking", "status", token],
|
||||||
queryFn: () => queryClient.cancellation.getBookingByToken({ token }),
|
// oRPC React Query Helper liefert .queryOptions()
|
||||||
|
...queryClient.cancellation.getBookingByToken.queryOptions({ token }),
|
||||||
retry: false,
|
retry: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Cancellation mutation
|
// Cancellation mutation
|
||||||
const cancelMutation = useMutation({
|
const cancelMutation = useMutation({
|
||||||
mutationFn: () => queryClient.cancellation.cancelByToken({ token }),
|
// oRPC React Query Helper liefert .mutationOptions()
|
||||||
|
...queryClient.cancellation.cancelByToken.mutationOptions(),
|
||||||
onSuccess: (result) => {
|
onSuccess: (result) => {
|
||||||
setCancellationResult({
|
setCancellationResult({
|
||||||
success: true,
|
success: true,
|
||||||
@@ -90,7 +92,7 @@ export default function BookingStatusPage({ token }: BookingStatusPageProps) {
|
|||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
setIsCancelling(true);
|
setIsCancelling(true);
|
||||||
setCancellationResult(null);
|
setCancellationResult(null);
|
||||||
cancelMutation.mutate();
|
cancelMutation.mutate({ token });
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
|
@@ -5,7 +5,7 @@ import { createKV } from "@/server/lib/create-kv";
|
|||||||
import { createKV as createAvailabilityKV } from "@/server/lib/create-kv";
|
import { createKV as createAvailabilityKV } from "@/server/lib/create-kv";
|
||||||
import { sendEmail, sendEmailWithAGB, sendEmailWithAGBAndCalendar, sendEmailWithInspirationPhoto } from "@/server/lib/email";
|
import { sendEmail, sendEmailWithAGB, sendEmailWithAGBAndCalendar, sendEmailWithInspirationPhoto } from "@/server/lib/email";
|
||||||
import { renderBookingPendingHTML, renderBookingConfirmedHTML, renderBookingCancelledHTML, renderAdminBookingNotificationHTML } from "@/server/lib/email-templates";
|
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 { createORPCClient } from "@orpc/client";
|
||||||
import { RPCLink } from "@orpc/client/fetch";
|
import { RPCLink } from "@orpc/client/fetch";
|
||||||
import { checkBookingRateLimit, getClientIP } from "@/server/lib/rate-limiter";
|
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
|
// Create a server-side client to call other RPC endpoints
|
||||||
const link = new RPCLink({ url: "http://localhost:5173/rpc" });
|
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
|
// Helper function to convert date from yyyy-mm-dd to dd.mm.yyyy
|
||||||
function formatDateGerman(dateString: string): string {
|
function formatDateGerman(dateString: string): string {
|
||||||
|
@@ -16,7 +16,6 @@ export default defineConfig(({ mode }) => {
|
|||||||
host: "0.0.0.0",
|
host: "0.0.0.0",
|
||||||
port: 5173,
|
port: 5173,
|
||||||
// Erlaube Zugriffe von beliebigen Hosts (lokal + Proxy/Funnel)
|
// Erlaube Zugriffe von beliebigen Hosts (lokal + Proxy/Funnel)
|
||||||
allowedHosts: ["localhost", "127.0.0.1", "master11.warbler-bearded.ts.net", ".ts.net"],
|
|
||||||
cors: true,
|
cors: true,
|
||||||
// Keine explizite HMR/Origin-Konfiguration, Vite-Defaults für localhost funktionieren am stabilsten
|
// Keine explizite HMR/Origin-Konfiguration, Vite-Defaults für localhost funktionieren am stabilsten
|
||||||
},
|
},
|
||||||
@@ -30,8 +29,6 @@ export default defineConfig(({ mode }) => {
|
|||||||
// it interferes with image imports.
|
// it interferes with image imports.
|
||||||
exclude: [/src\/client\/.*/, ...defaultOptions.exclude],
|
exclude: [/src\/client\/.*/, ...defaultOptions.exclude],
|
||||||
entry: "./src/server/index.ts",
|
entry: "./src/server/index.ts",
|
||||||
// Allow all hosts for Tailscale Funnel
|
|
||||||
allowedHosts: ["localhost", "127.0.0.1", "master11.warbler-bearded.ts.net", ".ts.net"],
|
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user