Skip to content

Commit

Permalink
prevent hub listen when hiding toast
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Davies committed Mar 9, 2021
1 parent 6244f68 commit 4bf86ee
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class AmplifyAuthenticator {
this.onAuthStateChange(authState, authData as CognitoUserInterface);
this.toastMessage = '';
});
Hub.listen(UI_AUTH_CHANNEL, this.handleToastEvent);
if (!this.hideToast) Hub.listen(UI_AUTH_CHANNEL, this.handleToastEvent);
Hub.listen(AUTH_CHANNEL, this.handleExternalAuthEvent);

appendToCognitoUserAgent('amplify-authenticator');
Expand Down Expand Up @@ -182,7 +182,7 @@ export class AmplifyAuthenticator {

componentWillUnload() {
Hub.remove(AUTH_CHANNEL, this.handleExternalAuthEvent);
Hub.remove(UI_AUTH_CHANNEL, this.handleToastEvent);
if (!this.hideToast) Hub.remove(UI_AUTH_CHANNEL, this.handleToastEvent);
return onAuthUIStateChange;
}

Expand Down

0 comments on commit 4bf86ee

Please sign in to comment.