import { useQuery } from "@tanstack/react-query"; import Warning from "../../../assets/gifs/warning.gif"; import useAxios from "../../../hooks/useAxios"; import Alert from "../../../components/alert/Alert"; import Button from "../../../components/button"; type TermsContent = { title: string; introduction: string; notice: string; preamble: string; clauses: string[]; }; const Rules = () => { const axios = useAxios(); const { data, isLoading, isError, refetch } = useQuery({ queryKey: ["siteTerms"], queryFn: async () => { const response = await axios.get<{ result: TermsContent }>("/home/terms"); return response.data.result; }, staleTime: 0, }); if (isLoading) { return

در حال دریافت قوانین و مقررات...

; } if (isError || !data) { return (
دریافت قوانین و مقررات انجام نشد. دوباره تلاش کنید.
); } return (

{data.title}

{data.introduction && (

{data.introduction}

)} {data.notice && (

{data.notice}

)} {data.preamble && (

{data.preamble}

)}
); }; export default Rules;