Skip to content

Commit 721b377

Browse files
chore: cleanup
1 parent 70d7c02 commit 721b377

9 files changed

Lines changed: 47 additions & 83 deletions

File tree

src/common-components/PasswordField.jsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ import { validatePasswordField } from '../register/data/utils';
1717

1818
const PasswordField = (props) => {
1919
const { formatMessage } = useIntl();
20-
21-
// const validationApiRateLimited = useSelector(state => state.register.validationApiRateLimited);
2220
const [isPasswordHidden, setHiddenTrue, setHiddenFalse] = useToggle(true);
2321
const [showTooltip, setShowTooltip] = useState(false);
2422

@@ -65,7 +63,6 @@ const PasswordField = (props) => {
6563
if (fieldError) {
6664
props.handleErrorChange('password', fieldError);
6765
} else if (!validationApiRateLimited) {
68-
// dispatch(fetchRealtimeValidations({ password: passwordValue }));
6966
fieldValidationsMutation.mutate({ password: passwordValue });
7067
}
7168
}
@@ -81,7 +78,6 @@ const PasswordField = (props) => {
8178
}
8279
if (props.handleErrorChange) {
8380
props.handleErrorChange('password', '');
84-
// dispatch(clearRegistrationBackendError('password'));
8581
clearRegistrationBackendError('password');
8682
}
8783
setTimeout(() => setShowTooltip(props.showRequirements && true), 150);

src/login/data/sagas.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// todo: delete this file
2+
// import { camelCaseObject, logError, logInfo } from '@openedx/frontend-base';
3+
// import { call, put, takeEvery } from 'redux-saga/effects';
4+
5+
// import {
6+
// LOGIN_REQUEST,
7+
// loginRequestBegin,
8+
// loginRequestFailure,
9+
// loginRequestSuccess,
10+
// } from './actions';
11+
// import { FORBIDDEN_REQUEST, INTERNAL_SERVER_ERROR } from './constants';
12+
// import {
13+
// loginRequest,
14+
// } from './service';
15+
16+
// export function* handleLoginRequest(action) {
17+
// try {
18+
// yield put(loginRequestBegin());
19+
20+
// const { redirectUrl, success } = yield call(loginRequest, action.payload.creds);
21+
22+
// yield put(loginRequestSuccess(
23+
// redirectUrl,
24+
// success,
25+
// ));
26+
// } catch (e) {
27+
// const statusCodes = [400];
28+
// if (e.response) {
29+
// const { status } = e.response;
30+
// if (statusCodes.includes(status)) {
31+
// yield put(loginRequestFailure(camelCaseObject(e.response.data)));
32+
// logInfo(e);
33+
// } else if (status === 403) {
34+
// yield put(loginRequestFailure({ errorCode: FORBIDDEN_REQUEST }));
35+
// logInfo(e);
36+
// } else {
37+
// yield put(loginRequestFailure({ errorCode: INTERNAL_SERVER_ERROR }));
38+
// logError(e);
39+
// }
40+
// }
41+
// }
42+
// }
43+
44+
// export default function* saga() {
45+
// yield takeEvery(LOGIN_REQUEST.BASE, handleLoginRequest);
46+
// }

src/logistration/Logistration.jsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,6 @@ const LogistrationPageInner = ({
2929
selectedPage,
3030
}) => {
3131
const tpaHint = getTpaHint();
32-
// const tpaProviders = useSelector(tpaProvidersSelector);
33-
// const dispatch = useDispatch();
34-
// const {
35-
// providers,
36-
// secondaryProviders,
37-
// } = tpaProviders;
3832
const {
3933
thirdPartyAuthContext,
4034
clearThirdPartyAuthErrorMessage,
@@ -81,14 +75,7 @@ const LogistrationPageInner = ({
8175
return;
8276
}
8377
sendTrackEvent(`edx.bi.${tabKey.replace('/', '')}_form.toggled`, { category: 'user-engagement' });
84-
// dispatch(clearThirdPartyAuthContextErrorMessage());
8578
clearThirdPartyAuthErrorMessage();
86-
// this is not needned anymore since we are using context
87-
// if (tabKey === LOGIN_PAGE) {
88-
// dispatch(backupRegistrationForm());
89-
// } else if (tabKey === REGISTER_PAGE) {
90-
// dispatch(backupLoginForm());
91-
// }
9279
setKey(tabKey);
9380
};
9481

src/progressive-profiling/ProgressiveProfiling.jsx

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ import { FormFieldRenderer } from '../field-renderer';
4040

4141
const ProgressiveProfilingInner = () => {
4242
const { formatMessage } = useIntl();
43-
// const {
44-
// //submitState, // done
45-
// //showError, // done
46-
// // welcomePageContext,
47-
// welcomePageContextApiStatus, //
48-
// } = props;
4943
const {
5044
thirdPartyAuthApiStatus,
5145
setThirdPartyAuthContextSuccess,
@@ -308,18 +302,6 @@ const ProgressiveProfilingInner = () => {
308302
);
309303
};
310304

311-
// const mapStateToProps = state => {
312-
// const welcomePageStore = state.welcomePage;
313-
314-
// return {
315-
// shouldRedirect: welcomePageStore.success,
316-
// showError: welcomePageStore.showError,
317-
// submitState: welcomePageStore.submitState,
318-
// welcomePageContext: welcomePageContextSelector(state),
319-
// welcomePageContextApiStatus: state.commonComponents.thirdPartyAuthApiStatus,
320-
// };
321-
// };
322-
323305
const ProgressiveProfiling = (props) => (
324306
<ThirdPartyAuthProvider>
325307
<ProgressiveProfilingProvider>
@@ -329,11 +311,3 @@ const ProgressiveProfiling = (props) => (
329311
);
330312

331313
export default ProgressiveProfiling;
332-
333-
// export default connect(
334-
// mapStateToProps,
335-
// {
336-
// saveUserProfile,
337-
// getFieldDataFromBackend: getThirdPartyAuthContext,
338-
// },
339-
// )(ProgressiveProfiling);

src/register/RegistrationFields/CountryField/CountryField.jsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ const CountryField = (props) => {
2929
onFocusHandler,
3030
} = props;
3131
const { formatMessage } = useIntl();
32-
// const dispatch = useDispatch();
3332

3433
const {
3534
clearRegistrationBackendError,
@@ -42,8 +41,6 @@ const CountryField = (props) => {
4241
selectionId: selectedCountry.countryCode,
4342
};
4443

45-
// const backendCountryCode = useSelector(state => state.register.backendCountryCode);
46-
4744
useEffect(() => {
4845
if (backendCountryCode && backendCountryCode !== selectedCountry?.countryCode) {
4946
let countryCode = '';
@@ -84,7 +81,6 @@ const CountryField = (props) => {
8481

8582
const handleOnFocus = (event) => {
8683
handleErrorChange('country', '');
87-
// dispatch(clearRegistrationBackendError('country'));
8884
clearRegistrationBackendError('country');
8985
onFocusHandler(event);
9086
};

src/register/RegistrationFields/EmailField/EmailField.jsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import messages from '../../messages';
2525
*/
2626
const EmailField = (props) => {
2727
const { formatMessage } = useIntl();
28-
// const dispatch = useDispatch();
2928

3029
const {
3130
setValidationsSuccess,
@@ -50,9 +49,7 @@ const EmailField = (props) => {
5049
setValidationsFailure();
5150
},
5251
});
53-
// todo: check this part
54-
// const backedUpFormData = useSelector(state => state.register.registrationFormData);
55-
// const validationApiRateLimited = useSelector(state => state.register.validationApiRateLimited);
52+
5653
const backedUpFormData = registrationFormData;
5754
const [emailSuggestion, setEmailSuggestion] = useState({ ...backedUpFormData?.emailSuggestion });
5855

@@ -68,7 +65,6 @@ const EmailField = (props) => {
6865
handleErrorChange('confirm_email', confirmEmailError);
6966
}
7067
setEmailSuggestionContext(suggestion.suggestion, suggestion.type);
71-
// dispatch(setEmailSuggestionInStore(suggestion));
7268
setEmailSuggestion(suggestion);
7369

7470
if (fieldError) {
@@ -81,7 +77,6 @@ const EmailField = (props) => {
8177
const handleOnFocus = () => {
8278
handleErrorChange('email', '');
8379
clearRegistrationBackendError('email');
84-
// dispatch(clearRegistrationBackendError('email'));
8580
};
8681

8782
const handleSuggestionClick = (event) => {

src/register/RegistrationFields/NameField/NameField.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ const NameField = (props) => {
2525
clearRegistrationBackendError,
2626
} = useRegisterContext();
2727

28-
// const validationApiRateLimited = useSelector(state => state.register.validationApiRateLimited);
2928
const fieldValidationsMutation = useFieldValidations({
3029
onSuccess: (data) => {
3130
setValidationsSuccess(data);
@@ -46,7 +45,6 @@ const NameField = (props) => {
4645
handleErrorChange('name', fieldError);
4746
} else if (shouldFetchUsernameSuggestions && !validationApiRateLimited) {
4847
fieldValidationsMutation.mutate({ name: value });
49-
// dispatch(fetchRealtimeValidations({ name: value }));
5048
}
5149
};
5250

src/register/RegistrationFields/UsernameField/UsernameField.jsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import messages from '../../messages';
2525
*/
2626
const UsernameField = (props) => {
2727
const { formatMessage } = useIntl();
28-
// const dispatch = useDispatch();
2928

3029
const {
3130
value,
@@ -55,9 +54,6 @@ const UsernameField = (props) => {
5554
},
5655
});
5756

58-
// const usernameSuggestions = useSelector(state => state.register.usernameSuggestions);
59-
// const validationApiRateLimited = useSelector(state => state.register.validationApiRateLimited);
60-
6157
/**
6258
* We need to remove the placeholder from the field, adding a space will do that.
6359
* This is needed because we are placing the username suggestions on top of the field.
@@ -74,7 +70,6 @@ const UsernameField = (props) => {
7470
if (fieldError) {
7571
handleErrorChange('username', fieldError);
7672
} else if (!validationApiRateLimited) {
77-
// dispatch(fetchRealtimeValidations({ username }));
7873
fieldValidationsMutation.mutate({ username });
7974
}
8075
};
@@ -92,7 +87,6 @@ const UsernameField = (props) => {
9287

9388
const handleOnFocus = (event) => {
9489
const username = event.target.value;
95-
// dispatch(clearUsernameSuggestions());
9690
clearUsernameSuggestions();
9791
// If we added a space character to username field to display the suggestion
9892
// remove it before user enters the input. This is to ensure user doesn't

src/register/RegistrationPage.jsx

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,6 @@ const RegistrationPage = (props) => {
9797
} = props;
9898

9999
const backendRegistrationError = registrationError;
100-
// useSelector(state => state.register.registrationError);
101-
102-
// React query for registration API
103-
// new function from hook
104100
const registrationMutation = useRegistration({
105101
onSuccess: (data) => {
106102
setRegistrationResult(data);
@@ -112,24 +108,9 @@ const RegistrationPage = (props) => {
112108
});
113109

114110
const registrationErrorCode = registrationError?.errorCode || backendRegistrationError?.errorCode;
115-
// Use context state for registrationResult instead of Redux - removed backup functionality
116-
// const userPipelineDataLoaded = useSelector(state => state.register.userPipelineDataLoaded);
117111
const submitState = registrationMutation.isLoading ? PENDING_STATE : DEFAULT_STATE;
118-
119-
// const fieldDescriptions = useSelector(state => state.commonComponents.fieldDescriptions);
120-
// const optionalFields = useSelector(state => state.commonComponents.optionalFields);
121-
// const thirdPartyAuthApiStatus = useSelector(state => state.commonComponents.thirdPartyAuthApiStatus);
122-
// const autoSubmitRegForm = useSelector(state => state.commonComponents.thirdPartyAuthContext.autoSubmitRegForm);
123-
// const thirdPartyAuthErrorMessage = useSelector(state => state.commonComponents.thirdPartyAuthContext.errorMessage);
124-
// const finishAuthUrl = useSelector(state => state.commonComponents.thirdPartyAuthContext.finishAuthUrl);
125-
// const currentProvider = useSelector(state => state.commonComponents.thirdPartyAuthContext.currentProvider);
126-
// const providers = useSelector(state => state.commonComponents.thirdPartyAuthContext.providers);
127-
// const secondaryProviders = useSelector(state => state.commonComponents.thirdPartyAuthContext.secondaryProviders);
128-
// const pipelineUserDetails = useSelector(state => state.commonComponents.thirdPartyAuthContext.pipelineUserDetails);
129-
130112
const queryParams = useMemo(() => getAllPossibleQueryParams(), []);
131113
const tpaHint = useMemo(() => getTpaHint(), []);
132-
133114
// Initialize form state from local backedUpFormData
134115
const backedUpFormData = registrationFormData;
135116
const [formFields, setFormFields] = useState({ ...backedUpFormData.formFields });
@@ -158,7 +139,6 @@ const RegistrationPage = (props) => {
158139
...prevState, name, username, email,
159140
}));
160141
setUserPipelineDataLoaded(true);
161-
// dispatch(setUserPipelineDataLoaded(true));
162142
}
163143
}
164144
}, [ // eslint-disable-line react-hooks/exhaustive-deps
@@ -227,7 +207,6 @@ const RegistrationPage = (props) => {
227207
const value = event.target.type === 'checkbox' ? event.target.checked : event.target.value;
228208
if (backendRegistrationError[name]) {
229209
clearRegistrationBackendError(name);
230-
// dispatch(clearRegistrationBackendError(name));
231210
}
232211
// Clear context registration errors
233212
if (registrationError.errorCode) {
@@ -287,7 +266,6 @@ const RegistrationPage = (props) => {
287266
);
288267
setErrors({ ...fieldErrors });
289268
setEmailSuggestionContext(emailSuggestion.suggestion, emailSuggestion.type);
290-
// dispatch(setEmailSuggestionInStore(emailSuggestion));
291269

292270
// returning if not valid
293271
if (!isValid) {

0 commit comments

Comments
 (0)