improved seo, made not-found page, fixed bugs in news details and in report datails pages

This commit is contained in:
Alibek committed 2024-03-14 04:13:08 +06:00
1 parent 7d36510a9b
commit ad86f2e79e
18 files changed
+224 -30

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
"use client";
import NotFound from "@/widgets/NotFound/NotFound";
const error = () => {
return <NotFound />;
};
export default error;
+32 -12
View File
@@ -6,6 +6,8 @@ import ReportInformation from "@/widgets/report-details/ReportInformation/Report
import ReportImages from "@/widgets/report-details/ReportImages/ReportImages";
import dynamic from "next/dynamic";
import BreadCrumbs from "@/features/BreadCrumbs/BreadCrumbs";
import NotFound from "@/widgets/NotFound/NotFound";
import { apiInstance } from "@/shared/config/apiConfig";
const DynamicMap = dynamic(
() => import("@/widgets/report-details/ReportMap/ReportMap"),
@@ -14,27 +16,45 @@ const DynamicMap = dynamic(
}
);
export const metadata: Metadata = {
title: "KG ROAD | Обращение",
description:
"Страница обращения Kyrgyzstan Transperency International",
};
export async function generateMetadata({
params,
}: {
params: { id: string };
}): Promise<Metadata> {
const response = await apiInstance.get<IReport>(
`/report/${params.id}/`
);
return {
title: `KG ROAD | ${response.data.location[0].address}`,
description: response.data.description,
openGraph: {
title: `KG ROAD | ${response.data.location[0].address}`,
description: response.data.description,
images: [response.data.image[0].image],
type: "website",
},
};
}
const ReportDetails = async ({
params,
}: {
params: { id: string };
}) => {
console.log(JSON.parse(params.id));
const getReportDetails = async () => {
const res = await fetch(
`${process.env.NEXT_PUBLIC_BASE_API}/report/${params.id}/`,
{ cache: "no-store" }
);
try {
const res = await fetch(
`${process.env.NEXT_PUBLIC_BASE_API}/report/${params.id}/`,
{ cache: "no-store" }
);
return res.json();
return res.json();
} catch (error) {
console.log(error);
}
};
const report: IReport = (await getReportDetails()) || {};
const report: IReport = await getReportDetails();
return (
<div className="report-details page-padding">