Skip to content

Commit

Permalink
adjusted keynames and added some logging (#29646)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelclement authored May 9, 2024
1 parent 85bca4d commit d59fd63
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 5 deletions.
37 changes: 33 additions & 4 deletions src/applications/ivc-champva/10-7959f-1/config/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ import {
// checkboxGroupSchema,
} from 'platform/forms-system/src/js/web-component-patterns';

import {
getNextPagePath,
checkValidPagePath,
} from '@department-of-veterans-affairs/platform-forms-system/routing';
import transformForSubmit from './submitTransformer';
import manifest from '../manifest.json';
import prefillTransformer from './prefillTransformer';
Expand Down Expand Up @@ -49,6 +53,31 @@ const formConfig = {
customText: {
appType: 'form',
},
// This is here temporarily to allow us to log SIP/Prefill data on staging
onFormLoaded: props => {
// TODO: Remove all this when we've verified we're getting the right data.
const { formData, returnUrl } = props;
// Check valid return URL; copied from RoutedSavableApp
const isValidReturnUrl = checkValidPagePath(
props.routes[props.routes.length - 1].pageList,
formData,
returnUrl,
);
if (isValidReturnUrl) {
props.router.push(returnUrl);
} else {
const nextPagePath = getNextPagePath(
props.routes[props.routes.length - 1].pageList,
formData,
'/introduction',
);
props.router.push(nextPagePath);
}
// Show whatever formData we have at this time, which should include data
// produced by the prefill transformer
// eslint-disable-next-line no-console
console.log('Form loaded - data: ', formData);
},
preSubmitInfo: {
statementOfTruth: {
body:
Expand Down Expand Up @@ -94,11 +123,11 @@ const formConfig = {
messageAriaDescribedby:
'We use this information to verify other details.',
veteranFullName: veteranFullNameUI,
veteranDateOfBirth: dateOfBirthUI(),
veteranDateOfBirth: dateOfBirthUI({ required: true }),
},
schema: {
type: 'object',
required: ['fullName', 'veteranDOB'],
required: ['veteranFullName', 'veteranDateOfBirth'],
properties: {
titleSchema,
veteranFullName: fullNameSchema,
Expand All @@ -125,7 +154,7 @@ const formConfig = {
},
schema: {
type: 'object',
required: ['ssn'],
required: ['veteranSocialSecurityNumber'],
properties: {
titleSchema,
veteranSocialSecurityNumber: ssnOrVaFileNumberSchema,
Expand Down Expand Up @@ -159,7 +188,7 @@ const formConfig = {
},
schema: {
type: 'object',
required: ['mailingAddress'],
required: ['veteranAddress'],
properties: {
titleSchema,
veteranAddress: addressSchema({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const prefillTransformer = (pages, metadata, formData) => {
const prefillTransformer = (pages, formData, metadata) => {
return {
pages,
formData: {
Expand Down

0 comments on commit d59fd63

Please sign in to comment.