Behebe Impressum/Datenschutz-Tab und bereinige UI
- Impressum-Tab zeigt jetzt korrekt rechtliche Informationen an - Direkter HTTP-Endpoint /api/legal-config als Workaround für RPC-Problem - Client-Komponente verwendet fetch() anstatt RPC-Calls - Debug-Logs hinzugefügt für bessere Fehlerdiagnose - Hinweis-Text über Umgebungsvariablen entfernt für saubereres Design - Legal-Konfiguration funktioniert jetzt vollständig mit echten Daten - Tab-Navigation zwischen Impressum und Datenschutz funktioniert
This commit is contained in:
@@ -1,13 +1,27 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { queryClient } from "@/client/rpc-client";
|
|
||||||
|
|
||||||
export default function LegalPage() {
|
export default function LegalPage() {
|
||||||
const [activeSection, setActiveSection] = useState<"impressum" | "datenschutz">("impressum");
|
const [activeSection, setActiveSection] = useState<"impressum" | "datenschutz">("impressum");
|
||||||
|
|
||||||
const { data: legalConfig, isLoading, error } = useQuery({
|
const { data: legalConfig, isLoading, error } = useQuery({
|
||||||
queryKey: ["legal", "config"],
|
queryKey: ["legal", "config"],
|
||||||
queryFn: () => queryClient.legal.getConfig(),
|
queryFn: async () => {
|
||||||
|
console.log("Fetching legal config...");
|
||||||
|
try {
|
||||||
|
const response = await fetch("/api/legal-config");
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
}
|
||||||
|
const result = await response.json();
|
||||||
|
console.log("Legal config result:", result);
|
||||||
|
return result;
|
||||||
|
} catch (err) {
|
||||||
|
console.error("Legal config error:", err);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
retry: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
@@ -36,6 +50,9 @@ export default function LegalPage() {
|
|||||||
<h2 className="text-xl font-bold text-gray-900 mb-2">Fehler</h2>
|
<h2 className="text-xl font-bold text-gray-900 mb-2">Fehler</h2>
|
||||||
<p className="text-gray-600 mb-4">
|
<p className="text-gray-600 mb-4">
|
||||||
Die rechtlichen Informationen konnten nicht geladen werden.
|
Die rechtlichen Informationen konnten nicht geladen werden.
|
||||||
|
{error && (
|
||||||
|
<><br /><span className="text-sm text-red-600">Fehler: {error.message}</span></>
|
||||||
|
)}
|
||||||
</p>
|
</p>
|
||||||
<a
|
<a
|
||||||
href="/"
|
href="/"
|
||||||
@@ -108,9 +125,6 @@ export default function LegalPage() {
|
|||||||
<strong>{legalConfig.companyName}</strong><br />
|
<strong>{legalConfig.companyName}</strong><br />
|
||||||
Inhaber: {legalConfig.ownerName}
|
Inhaber: {legalConfig.ownerName}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-sm text-gray-500 mt-2">
|
|
||||||
ℹ️ Diese Informationen können über Umgebungsvariablen in der .env-Datei angepasst werden.
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
@@ -16,6 +16,18 @@ app.get("/health", (c) => {
|
|||||||
return c.json({ status: "ok", timestamp: new Date().toISOString() });
|
return c.json({ status: "ok", timestamp: new Date().toISOString() });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Legal config endpoint (temporary fix for RPC issue)
|
||||||
|
app.get("/api/legal-config", async (c) => {
|
||||||
|
try {
|
||||||
|
const { getLegalConfig } = await import("./lib/legal-config");
|
||||||
|
const config = getLegalConfig();
|
||||||
|
return c.json(config);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Legal config error:", error);
|
||||||
|
return c.json({ error: "Failed to load legal config" }, 500);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
app.route("/rpc", rpcApp);
|
app.route("/rpc", rpcApp);
|
||||||
app.get("/*", clientEntry);
|
app.get("/*", clientEntry);
|
||||||
|
|
||||||
|
@@ -3,6 +3,14 @@ import { getLegalConfig } from "@/server/lib/legal-config";
|
|||||||
|
|
||||||
export const router = {
|
export const router = {
|
||||||
getConfig: os.handler(async () => {
|
getConfig: os.handler(async () => {
|
||||||
return getLegalConfig();
|
console.log("Legal getConfig called");
|
||||||
|
try {
|
||||||
|
const config = getLegalConfig();
|
||||||
|
console.log("Legal config:", config);
|
||||||
|
return config;
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Legal config error:", error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user