From 09c0ef2b2b33ce3b004e630e91ce57302dd16797 Mon Sep 17 00:00:00 2001 From: Justin Hynes Date: Thu, 25 Jun 2020 14:32:51 -0400 Subject: [PATCH] reverse unneeded changes in sagas.js --- src/account-settings/data/sagas.js | 55 ++++++++----------- .../demographics/data/service.js | 8 +-- 2 files changed, 28 insertions(+), 35 deletions(-) diff --git a/src/account-settings/data/sagas.js b/src/account-settings/data/sagas.js index ad4c742..538089c 100644 --- a/src/account-settings/data/sagas.js +++ b/src/account-settings/data/sagas.js @@ -1,43 +1,40 @@ -import { call, put, delay, takeEvery, all } from 'redux-saga/effects'; - -import { publish } from '@edx/frontend-platform'; -import { getLocale, handleRtl, LOCALE_CHANGED } from '@edx/frontend-platform/i18n'; -import { getAuthenticatedUser } from '@edx/frontend-platform/auth'; - // Actions import { FETCH_SETTINGS, - fetchSettingsBegin, - fetchSettingsSuccess, - fetchSettingsFailure, - closeForm, - SAVE_SETTINGS, - SAVE_MULTIPLE_SETTINGS, - saveSettingsBegin, - saveSettingsSuccess, - saveSettingsFailure, - savePreviousSiteLanguage, FETCH_TIME_ZONES, + SAVE_MULTIPLE_SETTINGS, + SAVE_SETTINGS, + closeForm, + fetchSettingsBegin, + fetchSettingsFailure, + fetchSettingsSuccess, fetchTimeZones, fetchTimeZonesSuccess, saveMultipleSettingsBegin, - saveMultipleSettingsSuccess, saveMultipleSettingsFailure, + saveMultipleSettingsSuccess, + savePreviousSiteLanguage, + saveSettingsBegin, + saveSettingsFailure, + saveSettingsSuccess, } from './actions'; +import { LOCALE_CHANGED, getLocale, handleRtl } from '@edx/frontend-platform/i18n'; +import { all, call, delay, put, takeEvery } from 'redux-saga/effects'; +// Services +import { getSettings, getTimeZones, patchSettings } from './service'; +import { + patchPreferences, + postSetLang, + saga as siteLanguageSaga, +} from '../site-language'; // Sub-modules import { saga as deleteAccountSaga } from '../delete-account'; +import { getAuthenticatedUser } from '@edx/frontend-platform/auth'; +import { publish } from '@edx/frontend-platform'; import { saga as resetPasswordSaga } from '../reset-password'; -import { - saga as siteLanguageSaga, - patchPreferences, - postSetLang, -} from '../site-language'; import { saga as thirdPartyAuthSaga } from '../third-party-auth'; -// Services -import { getSettings, patchSettings, getTimeZones } from './service'; - export function* handleFetchSettings() { try { yield put(fetchSettingsBegin()); @@ -61,12 +58,8 @@ export function* handleFetchSettings() { timeZones, })); } catch (e) { - if (e.fieldErrors) { - yield put(fetchSettingsFailure({ fieldErrors: e.fieldErrors })); - } else { - yield put(fetchSettingsFailure(e.message)); - throw e; - } + yield put(fetchSettingsFailure(e.message)); + throw e; } } diff --git a/src/account-settings/demographics/data/service.js b/src/account-settings/demographics/data/service.js index eec096b..7afcad1 100644 --- a/src/account-settings/demographics/data/service.js +++ b/src/account-settings/demographics/data/service.js @@ -78,10 +78,10 @@ export async function patchDemographics(userId, commitValues) { ({ data } = await getAuthenticatedHttpClient() .patch(requestUrl, convertedCommitValues) .catch((error) => { - // if there was an error making the PATCH call then create an apiError object with a 'demographicsError' in the - // fieldErrors. This will trigger the `renderDemographicsServiceIssueWarningMessage()` (DemographicsSection.jsx) - // to display an Alert to let the end-user know that there may be an issue communicating with the Demographics - // service. + // If there was an error making the PATCH call then we create an apiError object containing a 'demographicsError' + // fieldError. The content of the error itself isn't particularly important. This will trigger the + // `renderDemographicsServiceIssueWarningMessage()` (DemographicsSection.jsx) to display an Alert to let the + // end-user know that there may be an issue communicating with the Demographics service. const apiError = Object.create(error); apiError.fieldErrors = { demographicsError: error.customAttributes.httpErrorType