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