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});
|
||||
this.setState(updatedState);
|
||||
|
||||
/** Reset action state after short timeout */
|
||||
this.timeoutId = setTimeout(() => {
|
||||
this.setState({
|
||||
action: ''
|
||||
});
|
||||
}, 2000);
|
||||
/** Reset action state after short timeout if not failed*/
|
||||
if (updatedState && updatedState.action && !updatedState.action.includes(':failed')) {
|
||||
this.timeoutId = setTimeout(() => {
|
||||
this.setState({
|
||||
action: ''
|
||||
});
|
||||
}, 2000);
|
||||
}
|
||||
} catch (error) {
|
||||
const popupNotification = createPopupNotification({
|
||||
type: `${action}:failed`,
|
||||
|
|
|
@ -297,7 +297,7 @@ async function updateProfile({data, state, api}) {
|
|||
return {
|
||||
action,
|
||||
...(dataUpdate.success ? {member: dataUpdate.member} : {}),
|
||||
page: 'accountHome',
|
||||
...(dataUpdate.success ? {page: 'accountHome'} : {}),
|
||||
popupNotification: createPopupNotification({
|
||||
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';
|
||||
return {
|
||||
action,
|
||||
...(emailUpdate.success ? {page: 'accountHome'} : {}),
|
||||
popupNotification: createPopupNotification({
|
||||
type: action, autoHide: emailUpdate.success, closeable: true, status, state, message
|
||||
})
|
||||
|
|
|
@ -126,9 +126,7 @@ export default class PopupNotification extends React.Component {
|
|||
}
|
||||
|
||||
closeNotification(e) {
|
||||
this.setState({
|
||||
className: 'slideout'
|
||||
});
|
||||
this.context.onAction('clearPopupNotification');
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
|
|
|
@ -48,6 +48,7 @@ export default class AccountProfilePage extends React.Component {
|
|||
const {email, name, errors} = this.state;
|
||||
const hasFormErrors = (errors && Object.values(errors).filter(d => !!d).length > 0);
|
||||
if (!hasFormErrors) {
|
||||
this.context.onAction('clearPopupNotification');
|
||||
this.context.onAction('updateProfile', {email, name});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue