mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Updated popup notification behavior for profile update
refs https://github.com/TryGhost/Team/issues/393 - Updates behavior of popup notification for account update - Updates popup notification clear without animation for manual close and retry click - Adds redirect to home page correctly for popup notification on success
This commit is contained in:
parent
266217e109
commit
dfd034b624
4 changed files with 12 additions and 10 deletions
|
@ -268,12 +268,14 @@ export default class App extends React.Component {
|
||||||
const updatedState = await ActionHandler({action, data, state: this.state, api: this.GhostApi});
|
const updatedState = await ActionHandler({action, data, state: this.state, api: this.GhostApi});
|
||||||
this.setState(updatedState);
|
this.setState(updatedState);
|
||||||
|
|
||||||
/** Reset action state after short timeout */
|
/** Reset action state after short timeout if not failed*/
|
||||||
this.timeoutId = setTimeout(() => {
|
if (updatedState && updatedState.action && !updatedState.action.includes(':failed')) {
|
||||||
this.setState({
|
this.timeoutId = setTimeout(() => {
|
||||||
action: ''
|
this.setState({
|
||||||
});
|
action: ''
|
||||||
}, 2000);
|
});
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const popupNotification = createPopupNotification({
|
const popupNotification = createPopupNotification({
|
||||||
type: `${action}:failed`,
|
type: `${action}:failed`,
|
||||||
|
|
|
@ -297,7 +297,7 @@ async function updateProfile({data, state, api}) {
|
||||||
return {
|
return {
|
||||||
action,
|
action,
|
||||||
...(dataUpdate.success ? {member: dataUpdate.member} : {}),
|
...(dataUpdate.success ? {member: dataUpdate.member} : {}),
|
||||||
page: 'accountHome',
|
...(dataUpdate.success ? {page: 'accountHome'} : {}),
|
||||||
popupNotification: createPopupNotification({
|
popupNotification: createPopupNotification({
|
||||||
type: action, autoHide: dataUpdate.success, closeable: true, status, state, message
|
type: action, autoHide: dataUpdate.success, closeable: true, status, state, message
|
||||||
})
|
})
|
||||||
|
@ -308,6 +308,7 @@ async function updateProfile({data, state, api}) {
|
||||||
const message = !emailUpdate.success ? 'Failed to send verification email' : 'Check your inbox to verify email update';
|
const message = !emailUpdate.success ? 'Failed to send verification email' : 'Check your inbox to verify email update';
|
||||||
return {
|
return {
|
||||||
action,
|
action,
|
||||||
|
...(emailUpdate.success ? {page: 'accountHome'} : {}),
|
||||||
popupNotification: createPopupNotification({
|
popupNotification: createPopupNotification({
|
||||||
type: action, autoHide: emailUpdate.success, closeable: true, status, state, message
|
type: action, autoHide: emailUpdate.success, closeable: true, status, state, message
|
||||||
})
|
})
|
||||||
|
|
|
@ -126,9 +126,7 @@ export default class PopupNotification extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
closeNotification(e) {
|
closeNotification(e) {
|
||||||
this.setState({
|
this.context.onAction('clearPopupNotification');
|
||||||
className: 'slideout'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
|
|
|
@ -48,6 +48,7 @@ export default class AccountProfilePage extends React.Component {
|
||||||
const {email, name, errors} = this.state;
|
const {email, name, errors} = this.state;
|
||||||
const hasFormErrors = (errors && Object.values(errors).filter(d => !!d).length > 0);
|
const hasFormErrors = (errors && Object.values(errors).filter(d => !!d).length > 0);
|
||||||
if (!hasFormErrors) {
|
if (!hasFormErrors) {
|
||||||
|
this.context.onAction('clearPopupNotification');
|
||||||
this.context.onAction('updateProfile', {email, name});
|
this.context.onAction('updateProfile', {email, name});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue