"use client";
import React, { useEffect, useState } from 'react'
import './privacy.css'
const PrivacyPolicy = () => {
    const [htmlContent, setHtmlContent] = useState("");
  const [loading,setLoading] = useState(false)
  const fetchdata = async () => {
    setLoading(true); 
    try {
      const response = await fetch("/api/privacy-policy", {
        method: "GET",
      });
      
      const resData = await response.json(); 
      setHtmlContent(resData.data); 
    } catch (error) {
      console.error("Error fetching data:", error);
    } finally {
      setLoading(false); 
    }
  };

  useEffect(() => {
    fetchdata();
  }, []);
  return (
    <div className="privacy-policy-container">
      {loading ? (
        <div className="loading-message">Loading content, please wait...</div>
      ) : htmlContent ? (
        <div dangerouslySetInnerHTML={{ __html: htmlContent }} />
      ) : (
        <div className="no-content-message">No content available</div>
      )}
    </div>
  )
}

export default PrivacyPolicy
