mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-28 07:50:32 +05:30
#248: Properly handle password confirm in profile form. Fixes sentry/#36
This commit is contained in:
parent
26caa13b5f
commit
848d33c195
@ -76,7 +76,7 @@ function restoreScroll() {
|
||||
const viewPort = document.body;
|
||||
|
||||
if (!viewPort) {
|
||||
console.log('Can not find viewPort element');
|
||||
console.log('Can not find viewPort element'); // eslint-disable-line
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
|
||||
import logger from 'services/logger';
|
||||
|
||||
import { FooterMenu } from 'components/footerMenu';
|
||||
|
||||
import styles from './profile.scss';
|
||||
@ -79,6 +81,13 @@ export default connect(null, {
|
||||
}
|
||||
})
|
||||
.then((resp) => !resp.requirePassword || requestPassword(form))
|
||||
.catch((resp) => {
|
||||
if (!resp || !resp.errors) {
|
||||
logger.warn('Unexpected profile editing error', {
|
||||
resp
|
||||
});
|
||||
}
|
||||
})
|
||||
.finally(() => form.endLoading());
|
||||
|
||||
function requestPassword(form) {
|
||||
@ -88,15 +97,15 @@ export default connect(null, {
|
||||
const onSubmit = () => {
|
||||
form.beginLoading();
|
||||
sendData()
|
||||
.then(resolve)
|
||||
.then(props.onClose)
|
||||
.catch((resp) => {
|
||||
if (resp.errors) {
|
||||
form.setErrors(resp.errors);
|
||||
} else {
|
||||
return Promise.reject(resp);
|
||||
}
|
||||
|
||||
return Promise.reject(resp);
|
||||
})
|
||||
.then(resolve)
|
||||
.then(props.onClose)
|
||||
.finally(() => form.endLoading());
|
||||
};
|
||||
|
||||
|
@ -23,7 +23,13 @@ const logger = {
|
||||
|
||||
window.addEventListener('unhandledrejection', (event) => {
|
||||
const error = event.reason || {};
|
||||
const message = error.message ? `: ${error.message}` : '';
|
||||
|
||||
let message = error.message || error;
|
||||
if (typeof message === 'string') {
|
||||
message = `: ${message}`;
|
||||
} else {
|
||||
message = '';
|
||||
}
|
||||
|
||||
logger.info(`Unhandled rejection${message}`, {
|
||||
error
|
||||
|
Loading…
Reference in New Issue
Block a user