diff --git a/src/account-settings/data/service.js b/src/account-settings/data/service.js index 264817c..96e81c8 100644 --- a/src/account-settings/data/service.js +++ b/src/account-settings/data/service.js @@ -9,6 +9,7 @@ import { handleRequestError, unpackFieldErrors } from './utils'; import { getThirdPartyAuthProviders } from '../third-party-auth'; import { getCoachingPreferences, patchCoachingPreferences } from '../coaching/data/service'; import { getDemographics, patchDemographics } from '../demographics/data/service'; +import { DEMOGRAPHICS_FIELDS } from '../demographics/data/utils'; const SOCIAL_PLATFORMS = [ { id: 'twitter', key: 'social_link_twitter' }, @@ -211,8 +212,9 @@ export async function patchSettings(username, commitValues, userId) { // user/v1/preferences where it does update. This is the one we use. const preferenceKeys = ['time_zone']; const coachingKeys = ['coaching']; + const demographicsKeys = DEMOGRAPHICS_FIELDS; const isDemographicsKey = (value, key) => key.includes('demographics'); - const accountCommitValues = omit(commitValues, preferenceKeys, coachingKeys); + const accountCommitValues = omit(commitValues, preferenceKeys, coachingKeys, demographicsKeys); const preferenceCommitValues = pick(commitValues, preferenceKeys); const coachingCommitValues = pick(commitValues, coachingKeys); const demographicsCommitValues = pickBy(commitValues, isDemographicsKey); diff --git a/src/account-settings/demographics/data/utils.js b/src/account-settings/demographics/data/utils.js index 6208352..f5609f8 100644 --- a/src/account-settings/demographics/data/utils.js +++ b/src/account-settings/demographics/data/utils.js @@ -1,5 +1,18 @@ export const TO = 'to'; export const FROM = 'from'; +export const DEMOGRAPHICS_FIELDS = [ + 'demographics_gender', + 'demographics_gender_description', + 'demographics_income', + 'demographics_learner_education_level', + 'demographics_parent_education_level', + 'demographics_military_history', + 'demographics_work_status', + 'demographics_work_status_description', + 'demographics_current_work_sector', + 'demographics_future_work_sector', + 'demographics_user_ethnicity', +]; // Frontend wants (example): // demographics_user_ethnicity: ["asian", "white", "other"]