forked from Transparency/kgroad-frontend2
improved seo, made not-found page, fixed bugs in news details and in report datails pages
This commit is contained in:
1 parent
7d36510a9b
commit
ad86f2e79e
18 files changed
+224
-30
No files matched your search
@@ -0,0 +1,9 @@
|
||||
"use client";
|
||||
|
||||
import NotFound from "@/widgets/NotFound/NotFound";
|
||||
|
||||
const error = () => {
|
||||
return <NotFound />;
|
||||
};
|
||||
|
||||
export default error;
|
||||
@@ -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">
|
||||
|
||||
Reference in new issue
Block a user