import { useMemo } from "react" import { useQuery } from "react-query" import { PageContentProps } from "~/types/pageContent" import { getPageContent } from "~/services/pageContent" type Props = { path: string } const PageContent = ({ path }: Props) => { const { data, isLoading } = useQuery(`page-content:${path}`, async () => await getPageContent({ path })) const parsedContent = useMemo(() => { if (!data) return '' return data.content.replaceAll( 'src="/web/image', `src="${process.env.NEXT_PUBLIC_ODOO_API_HOST}/web/image` ) }, [data]) if (isLoading) return return (
) } const PageContentSkeleton = () => (
) export default PageContent