From 73a898703b5ac719db1e3461491c08dd53417069 Mon Sep 17 00:00:00 2001 From: Courtney Myers Date: Fri, 22 Jul 2022 15:15:05 -0400 Subject: [PATCH 1/3] Move client app's checking of csb enrollment closed status to get response from /api/epa-data, so client app doesn't need to be rebuilt for env variable to take effect --- app/client/.env.example | 12 +++++------- app/client/src/components/dashboard.tsx | 5 +++-- app/client/src/config.tsx | 11 +---------- app/client/src/contexts/user.tsx | 1 + app/client/src/routes/allRebates.tsx | 8 +++++--- app/client/src/routes/existingRebate.tsx | 5 +++-- app/client/src/routes/newRebate.tsx | 6 +++--- app/server/app/routes/api.js | 1 + 8 files changed, 22 insertions(+), 27 deletions(-) diff --git a/app/client/.env.example b/app/client/.env.example index d2e849f0..4d4ad206 100644 --- a/app/client/.env.example +++ b/app/client/.env.example @@ -1,8 +1,6 @@ -# NOTE: For local development, set `REACT_APP_CSB_ENROLLMENT_PERIOD`, -# `REACT_APP_FORMIO_BASE_URL`, and `REACT_APP_FORMIO_PROJECT_NAME` to the same -# values used in the server app's `CSB_ENROLLMENT_PERIOD`, `FORMIO_BASE_URL`, -# and `FORMIO_PROJECT_NAME` env variables. When deployed, a GitHub Actions -# Workflow does this in the "build" npm script. -REACT_APP_CSB_ENROLLMENT_PERIOD= +# NOTE: For local development, set `REACT_APP_FORMIO_BASE_URL` and +# `REACT_APP_FORMIO_PROJECT_NAME` to the same values used in the server app's +# `FORMIO_BASE_URL` and `FORMIO_PROJECT_NAME` env variables. When deployed, a +# GitHub Actions Workflow does this in the "build" npm script. REACT_APP_FORMIO_BASE_URL= -REACT_APP_FORMIO_PROJECT_NAME= +REACT_APP_FORMIO_PROJECT_NAME= \ No newline at end of file diff --git a/app/client/src/components/dashboard.tsx b/app/client/src/components/dashboard.tsx index 45f876e0..89a78c72 100644 --- a/app/client/src/components/dashboard.tsx +++ b/app/client/src/components/dashboard.tsx @@ -8,7 +8,6 @@ import icons from "uswds/img/sprite.svg"; import { serverUrl, serverUrlForLinks, - enrollmentClosed, formioBaseUrl, formioProjectUrl, fetchData, @@ -190,7 +189,9 @@ export default function Dashboard() { )} - {pathname.startsWith("/rebate") || enrollmentClosed ? ( + {pathname.startsWith("/rebate") || + (epaUserData.status === "success" && + epaUserData.data?.enrollmentClosed) ? (