reverse unneeded changes in sagas.js

This commit is contained in:
Justin Hynes
2020-06-25 14:32:51 -04:00
parent 5ea94107af
commit 09c0ef2b2b
2 changed files with 28 additions and 35 deletions

View File

@@ -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;
}
}

View File

@@ -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