Skip to content

Commit

Permalink
make it route
Browse files Browse the repository at this point in the history
  • Loading branch information
13bfrancis committed Oct 9, 2024
1 parent e231f2d commit 9943e7d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 11 deletions.
15 changes: 7 additions & 8 deletions lib/packages/shared-utils/package-actions/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ const arIssueRai: ActionRule = {

const arRespondToRai: ActionRule = {
action: Action.RESPOND_TO_RAI,
check: (checker, user) =>
!checker.isTempExtension &&
checker.hasStatus(SEATOOL_STATUS.PENDING_RAI) &&
checker.hasLatestRai &&
// safety; prevent bad status from causing overwrite
(!checker.hasRaiResponse || checker.hasRaiWithdrawal) &&
isStateUser(user) &&
false,
check: (checker, user) => true,
// !checker.isTempExtension &&
// checker.hasStatus(SEATOOL_STATUS.PENDING_RAI) &&
// checker.hasLatestRai &&
// // safety; prevent bad status from causing overwrite
// (!checker.hasRaiResponse || checker.hasRaiWithdrawal) &&
// isStateUser(user)
};

const arTempExtension: ActionRule = {
Expand Down
1 change: 0 additions & 1 deletion react-app/src/features/forms/new-submission/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from "./Medicaid";
export * from "./Chip";
export * from "./post-submission/respond-to-rai"
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { useParams } from "react-router-dom";
import { RespondToRai } from "./respond-to-rai";

// /actions/respond-to-rai/Medicaid SPA/1234

// the keys will relate to this part of the route /actions/{key of postSubmissionForms}/authority/id
export const postSubmissionForms: Record<string, () => React.ReactNode> = {
"respond-to-rai": RespondToRai,
};

// /actions/withdraw-package/Medicaid SPA/MD-95-1000

export const PostSubmissionWrapper = () => {
const { type } = useParams();
const PostSubmissionForm = postSubmissionForms[type];

return <PostSubmissionForm />;
};
9 changes: 7 additions & 2 deletions react-app/src/router.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createBrowserRouter } from "react-router-dom";
import * as F from "@/features";
import * as C from "@/components";
import { PostSubmissionWrapper } from "@/features/forms/post-submission/post-submission-forms";
import { QueryClient } from "@tanstack/react-query";
export const queryClient = new QueryClient();

Expand Down Expand Up @@ -104,9 +105,13 @@ export const router = createBrowserRouter([
path: "/new-submission/spa/chip/landing/chip-eligibility",
element: <F.CHIPEligibilityLandingPage />,
},
// {
// path: "respondtorai/:authority/:id/:type",
// element: <F.RespondToRai />,
// },
{
path: "respondtorai/:authority/:id/:type",
element: <F.RespondToRai />,
path: "/actions/:type/:authority/:id",
element: <PostSubmissionWrapper />,
},
{ path: "/action/:authority/:id/:type", element: <F.ActionPage /> },
{ path: "/webforms", element: <F.WebformsList /> },
Expand Down

0 comments on commit 9943e7d

Please sign in to comment.