FPSMS-frontend
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

39 lines
1.1 KiB

  1. import { SearchParams } from "@/app/utils/fetchUtil";
  2. import { I18nProvider, getServerI18n } from "@/i18n";
  3. import { Typography } from "@mui/material";
  4. import isString from "lodash/isString";
  5. import { notFound } from "next/navigation";
  6. import { Suspense } from "react";
  7. import EditPrinter from "@/components/EditPrinter";
  8. import { fetchPrinterDetails } from "@/app/api/settings/printer/actions";
  9. type Props = {} & SearchParams;
  10. const EditPrinterPage: React.FC<Props> = async ({ searchParams }) => {
  11. const { t } = await getServerI18n("common");
  12. const id = isString(searchParams["id"])
  13. ? parseInt(searchParams["id"])
  14. : undefined;
  15. if (!id) {
  16. notFound();
  17. }
  18. const printer = await fetchPrinterDetails(id);
  19. if (!printer) {
  20. notFound();
  21. }
  22. return (
  23. <>
  24. <Typography variant="h4">{t("Edit")} {t("Printer")}</Typography>
  25. <I18nProvider namespaces={["common"]}>
  26. <Suspense fallback={<div>Loading...</div>}>
  27. <EditPrinter printer={printer} />
  28. </Suspense>
  29. </I18nProvider>
  30. </>
  31. );
  32. };
  33. export default EditPrinterPage;