84 lines
1.9 KiB
JavaScript
84 lines
1.9 KiB
JavaScript
import panelAxios from "../services/panelAxios";
|
|
|
|
export async function fetchPageContent(ip) {
|
|
try {
|
|
|
|
try {
|
|
const raw = JSON.stringify({
|
|
ViewStatisticsFromTheSite: {
|
|
IP: ip,
|
|
ViewTime: "",
|
|
ViewDate: "",
|
|
},
|
|
});
|
|
|
|
await panelAxios.post("http://bpms-back.sepehrdata.com/api/save", raw);
|
|
} catch (err) {
|
|
console.log("Submit failed:", err);
|
|
}
|
|
|
|
|
|
|
|
|
|
const response = await fetch("http://bpms-back.sepehrdata.com/api/select", {
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json;charset=UTF-8",
|
|
},
|
|
body: JSON.stringify({
|
|
ProcessName: "sepehrdata",
|
|
OutputFields: [
|
|
"company_name",
|
|
"company_latin_name",
|
|
"company_introduction",
|
|
"address",
|
|
"mobile1",
|
|
"mobile2",
|
|
"email1",
|
|
"logo",
|
|
"product_introduction",
|
|
"title_product_introduction1",
|
|
"title_product_introduction2",
|
|
"product_introduction_image",
|
|
"location_company",
|
|
"link_social_title1",
|
|
"logo_socail1",
|
|
"link_social_title2",
|
|
"logo_socail2",
|
|
"link_social_title3",
|
|
"logo_socail3",
|
|
"copy_right",
|
|
{ slider: ["*"] },
|
|
{ service: ["*"] },
|
|
{ customer: ["*"] },
|
|
],
|
|
}),
|
|
});
|
|
|
|
if (!response.ok) {
|
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
}
|
|
|
|
const data = await response.json();
|
|
console.log("Data received:", data);
|
|
const convertData = JSON.parse(data.data)[0];
|
|
|
|
return {
|
|
props: {
|
|
data: convertData,
|
|
},
|
|
};
|
|
} catch (error) {
|
|
console.error("❌ Error fetching data:", error);
|
|
|
|
return {
|
|
props: {
|
|
data: null,
|
|
error: "خطا در دریافت دادهها",
|
|
},
|
|
};
|
|
}
|
|
}
|
|
|
|
|