diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-10-23 17:11:33 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-10-23 17:11:33 +0700 |
| commit | 90710579ba1c12060877f6ec2d26103f9c31058d (patch) | |
| tree | 307032cfb8cd13b790c569bc443258b00b07684e /src-migrate/modules/page-content | |
| parent | a001da95b9c03167656aec8a573cf60c12164b3f (diff) | |
Refactor and migrate register page
Diffstat (limited to 'src-migrate/modules/page-content')
| -rw-r--r-- | src-migrate/modules/page-content/index.tsx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src-migrate/modules/page-content/index.tsx b/src-migrate/modules/page-content/index.tsx new file mode 100644 index 00000000..cbd58633 --- /dev/null +++ b/src-migrate/modules/page-content/index.tsx @@ -0,0 +1,22 @@ +import { useQuery } from "react-query" +import PageContentSkeleton from "~/common/components/skeleton/PageContentSkeleton" +import { PageContentProps } from "~/common/types/pageContent" +import { getPageContent } from "~/services/pageContent" + +type Props = { + path: string +} + +const PageContent = ({ path }: Props) => { + const { data, isLoading } = useQuery<PageContentProps>(`page-content:${path}`, async () => await getPageContent({ path })) + + if (isLoading) { + return <PageContentSkeleton /> + } + + return ( + <div dangerouslySetInnerHTML={{ __html: data?.content || '' }}></div> + ) +} + +export default PageContent
\ No newline at end of file |
