import { Metadata } from "next"; import { getServerI18n, I18nProvider } from "@/i18n"; // import { getServerI18n, I18nProvider } from "../../../../../i18n"; import Typography from "@mui/material/Typography"; import { isArray, parseInt } from "lodash"; import { notFound } from "next/navigation"; import { SearchParams, ServerFetchError } from "@/app/utils/fetchUtil"; import DetailedScheduleDetail from "@/components/DetailedScheduleDetail"; import { type } from "os"; import { fetchDetailedProdScheduleDetail } from "@/app/api/scheduling"; import { Suspense } from "react"; // import { ServerFetchError } from "../../../../../app/utils/fetchUtil"; // import DetailedScheduleDetail from "../../../../../components/DetailedScheduleDetail"; export const metadata: Metadata = { title: "FG Production Schedule", }; // interface Props { // searchParams: { [key: string]: string | string[] | undefined }; // } type Props = SearchParams; const DetailScheduling: React.FC = async ({ searchParams }) => { const { t } = await getServerI18n("schedule"); const id = searchParams["id"]; const type = "detailed" if (!id || isArray(id) || !isFinite(parseInt(id))) { notFound(); } try { await fetchDetailedProdScheduleDetail(parseInt(id)) } catch (e) { if (e instanceof ServerFetchError && (e.response?.status === 404 || e.response?.status === 400)) { console.log(e) notFound(); } } return ( <> {t("FG Production Schedule")} }> ); }; export default DetailScheduling;