fix display of a validation success message

This commit is contained in:
or-else
2022-08-25 15:02:11 -10:00
parent 0e53234d02
commit df203f48bd
6 changed files with 46 additions and 33 deletions
+9 -3
View File
@@ -331,7 +331,10 @@ class TinodeWeb extends React.Component {
if (!['cred', 'reset', 'register'].includes(parsedNav.path[0])) {
// Save possible topic name.
this.setState({requestedTopic: parsedNav.path[1]});
HashNavigation.navigateTo('');
const path = parsedNav.params && parsedNav.params.cred_done ?
HashNavigation.addUrlParam('', 'cred_done', parsedNav.params.cred_done):
'';
HashNavigation.navigateTo(path);
}
this.readTimer = null;
@@ -504,6 +507,10 @@ class TinodeWeb extends React.Component {
if (hash.params.code) {
this.setState({ credCode: hash.params.code });
}
// Validation was successful, show a message.
if (hash.params.cred_done) {
this.handleError(this.props.intl.formatMessage(messages.cred_confirmed_successfully), 'info');
}
// Additional parameters of panels.
this.setState({
@@ -1659,8 +1666,7 @@ class TinodeWeb extends React.Component {
const me = this.tinode.getMeTopic();
me.setMeta({cred: {meth: cred, resp: code}})
.then(_ => {
this.handleError(this.props.intl.formatMessage(cred_confirmed_successfully), 'info');
HashNavigation.navigateTo('');
HashNavigation.navigateTo(HashNavigation.addUrlParam('', 'cred_done', 1));
})
.catch((err) => {
this.handleError(err.message, 'err');