Skip to content

Commit

Permalink
Update fetchPRFSubmission() to support local development (modifies th…
Browse files Browse the repository at this point in the history
…e datasource components to use the local endpoints version when developing locally)
  • Loading branch information
courtneymyers committed Nov 27, 2024
1 parent 02f1c34 commit 997e444
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/server/app/utilities/formio.js
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,12 @@ function fetchPRFSubmission({ rebateYear, req, res }) {
return res.status(errorStatus).json({ message: errorMessage });
}

/** Modify 2024 PRF's NCES API endpoint URL for local development */
const formSchemaJson =
NODE_ENV === "development" && rebateYear === "2024"
? modifyDatasourceComponentsUrl(schema)
: schema;

/**
* NOTE: We can't just use the returned submission data here because
* Formio returns the string literal 'YES' instead of a base64 encoded
Expand All @@ -1493,7 +1499,7 @@ function fetchPRFSubmission({ rebateYear, req, res }) {
.then((submission) => {
return res.json({
userAccess: true,
formSchema: { url: formioFormUrl, json: schema },
formSchema: { url: formioFormUrl, json: formSchemaJson },
submission,
});
});
Expand Down

0 comments on commit 997e444

Please sign in to comment.