Updated default page to always open from trigger button

refs https://github.com/TryGhost/members.js/issues/77

- Portal button should always show the Subscribe/Account Home screen based on logged-in status
- Resets state to expected page on every open toggle
This commit is contained in:
Rish 2020-08-05 12:56:46 +05:30
parent bb7dba6fea
commit 7de783a252

View File

@ -168,7 +168,13 @@ class TriggerButtonContent extends React.Component {
}
onToggle() {
this.context.onAction('togglePopup');
const {showPopup, member} = this.context;
if (showPopup) {
this.context.onAction('closePopup');
} else {
const page = member ? 'accountHome' : 'signup';
this.context.onAction('openPopup', {page});
}
}
render() {