import LetterViewer from "@/record-management/components/common/letterViewer";
import { useLocation, useSearchParams } from "react-router-dom";

const ViewApprovalDetail = () => {
  const [searchParams] = useSearchParams();
  const location = useLocation();
  const pageIndex = searchParams.get("page") || "";
  const backUrl = `/record-management/approval/?page=${pageIndex}`;
  const approvalRow =
    (location.state as { approvalRow?: any } | null)?.approvalRow ?? null;
  return (
    <>
      <LetterViewer
        backurl={backUrl}
        type="approval"
        shouldFetchInstance={false}
        actions="MyApprovaRecordsActions"
        actionRowData={approvalRow}
      />
      ;
    </>
  );
};

export default ViewApprovalDetail;
