chore: setup project for production
This commit is contained in:
39
components/privacy-policy/PrivacyPolicy.jsx
Normal file
39
components/privacy-policy/PrivacyPolicy.jsx
Normal file
@@ -0,0 +1,39 @@
|
||||
"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
|
||||
Reference in New Issue
Block a user