Unverified Commit 4a1c5f17 authored by Zhou (Link)  Fang's avatar Zhou (Link) Fang Committed by GitHub
Browse files

Fixed can't skip a wg issue (#297)

* Fixed can't skip a wg issue

* Added a missing property back for updating formvalues
parent 2a8d4fe0
......@@ -80,6 +80,7 @@ export default function Application() {
purchasingAndVAT,
membershipLevel,
'membershipLevel-label': membershipLevelLabel,
workingGroups: formikWorkingGroups.values.workingGroups,
signingAuthorityRepresentative: signingAuthorityRepresentative,
};
setUpdatedFormValues(theNewValue);
......@@ -159,7 +160,7 @@ export default function Application() {
setUpdatedFormValues({ ...updatedFormValues, workingGroups });
console.log('updated working groups: ', values);
if (values.isJoiningWG) {
if (!values.skipJoiningWG) {
// If the user is joining at least 1 wg, then make related API call
const setFieldValueObj = {
fieldName: 'workingGroups',
......
......@@ -67,7 +67,7 @@ const WorkingGroupsWrapper = ({ formik, formikOrgValue, fullWorkingGroupList, wo
const handleClearData = () => {
// if user check it, we need to delete all wgs in formik and db
formik.values.workingGroups.map((item) => {
deleteData(currentFormId, END_POINT.working_groups, item.id, console.log, `Deleted ${item.workingGroup.label}`);
deleteData(currentFormId, END_POINT.working_groups, item.id, console.log, `Deleted ${item?.workingGroup?.label}`);
return null;
});
formik.setFieldValue('skipJoiningWG', true);
......
......@@ -89,7 +89,9 @@ export const validationSchema = [
// Third step - working groups
yup.object().shape({
workingGroups: yup.array().of(
workingGroups: yup.array().when('skipJoiningWG', {
is: false,
then: yup.array().of(
yup.object().shape({
workingGroup: yup
.object()
......@@ -106,6 +108,7 @@ export const validationSchema = [
})
),
}),
}),
// Forth, signing Authority
yup.object().shape({
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment