mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 15:12:58 +03:00
Reset popup state to default on closing magic link
closes https://github.com/TryGhost/members.js/issues/21 - Resets popup state to default page when magic link popup message is closed
This commit is contained in:
parent
49606f8fdf
commit
462eb1c1b2
@ -34,10 +34,10 @@ export default class ParentContainer extends React.Component {
|
|||||||
this.fetchData();
|
this.fetchData();
|
||||||
}
|
}
|
||||||
|
|
||||||
getDefaultPage({member, stripeParam}) {
|
getDefaultPage({member = this.state.member, stripeParam} = {}) {
|
||||||
// Change page here for testing local UI testing
|
// Change page here for testing local UI testing
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
return {page: 'accountHome'};
|
return {page: 'magiclink'};
|
||||||
}
|
}
|
||||||
if (!member && stripeParam === 'success') {
|
if (!member && stripeParam === 'success') {
|
||||||
return {page: 'magiclink', showPopup: true};
|
return {page: 'magiclink', showPopup: true};
|
||||||
@ -129,8 +129,10 @@ export default class ParentContainer extends React.Component {
|
|||||||
showPopup: !this.state.showPopup
|
showPopup: !this.state.showPopup
|
||||||
});
|
});
|
||||||
} else if (action === 'closePopup') {
|
} else if (action === 'closePopup') {
|
||||||
|
const {page: defaultPage} = this.getDefaultPage();
|
||||||
this.setState({
|
this.setState({
|
||||||
showPopup: false
|
showPopup: false,
|
||||||
|
page: this.state.page === 'magiclink' ? defaultPage : this.state.page
|
||||||
});
|
});
|
||||||
} else if (action === 'signout') {
|
} else if (action === 'signout') {
|
||||||
await this.GhostApi.member.signout();
|
await this.GhostApi.member.signout();
|
||||||
|
Loading…
Reference in New Issue
Block a user