Change some messageHandler actions

setup_complete does not close the dialog but
just allows marking the setup as completed.

close_dialog closes the dialog immediately.
This commit is contained in:
Jason Robinson 2020-11-26 12:40:55 +02:00
parent 116f109a62
commit 2aa36acae0

View File

@ -25,6 +25,7 @@ interface IProps {
} }
interface IState { interface IState {
completed: boolean,
error: string, error: string,
} }
@ -36,6 +37,7 @@ export default class HostingSignupDialog extends React.PureComponent<IProps, ISt
super(props); super(props);
this.state = { this.state = {
completed: false,
error: null, error: null,
}; };
@ -52,18 +54,25 @@ export default class HostingSignupDialog extends React.PureComponent<IProps, ISt
// noinspection JSIgnoredPromiseFromCall // noinspection JSIgnoredPromiseFromCall
this.sendAccountDetails(); this.sendAccountDetails();
break; break;
case 'setup_complete':
// Set as completed but let the user close the modal themselves
// so they have time to finish reading any information
this.setState({
completed: true,
});
break;
case 'openid_credentials_request': case 'openid_credentials_request':
// noinspection JSIgnoredPromiseFromCall // noinspection JSIgnoredPromiseFromCall
this.fetchOpenIDToken(); this.fetchOpenIDToken();
break; break;
case 'setup_complete': case 'close_dialog':
this.onFinished(true); this.onFinished(true);
break; break;
} }
} }
private onFinished = (result: boolean) => { private onFinished = (result: boolean) => {
if (result) { if (result || this.state.completed) {
// We're done, close // We're done, close
this.props.requestClose(); this.props.requestClose();
} else { } else {
@ -73,7 +82,6 @@ export default class HostingSignupDialog extends React.PureComponent<IProps, ISt
{ {
onFinished: result => { onFinished: result => {
if (result) { if (result) {
// TODO call an API endpoint to clean up?
this.props.requestClose(); this.props.requestClose();
} }
}, },