"use client"; import { useParams } from "next/navigation"; import { useQuery } from "@tanstack/react-query"; import Link from "next/link"; import { useTenantId } from "@/hooks/useTenantId"; import { experienceApi } from "@/modules/experience/services/experience-api"; import { ExperiencePageLoader, ExperiencePageError } from "@/modules/experience/pages/shared"; import { PageHeader, Card, CardContent, Badge, Button } from "@/components/ds"; export const PublicPreviewPage = function ExperiencePublicPreview() { const params = useParams(); const type = String(params.type); const id = String(params.id); const { tenantId } = useTenantId(); const resourceQ = useQuery({ queryKey: ["experience", tenantId, "preview", type, id], queryFn: async () => { if (type === "page") return experienceApi.pages.get(tenantId!, id); if (type === "site") return experienceApi.sites.get(tenantId!, id); if (type === "form") return experienceApi.forms.get(tenantId!, id); throw new Error("نوع نامعتبر"); }, enabled: !!tenantId && !!id, }); if (!tenantId || resourceQ.isLoading) return ; if (resourceQ.error) return resourceQ.refetch()} />; const r = resourceQ.data!; const title = String(r.title ?? r.name ?? r.code ?? id); return ( پیشنمایش عمومی publish_id موقت: {id} {JSON.stringify(r, null, 2)} بازگشت به پنل ); }; export default PublicPreviewPage;
{JSON.stringify(r, null, 2)}