diff --git a/okta-hosted-login/src/Navbar.jsx b/okta-hosted-login/src/Navbar.jsx index 4c31f406..d41042b1 100644 --- a/okta-hosted-login/src/Navbar.jsx +++ b/okta-hosted-login/src/Navbar.jsx @@ -37,7 +37,17 @@ export default withAuth(class Navbar extends Component { } async logout() { - this.props.auth.logout('/'); + let loginRedirect = this.login + // Redirect to '/' after logout + //if session is active + this.props.auth.logout('/') + .then(function (out){ + console.log("session is deleted"); + }) + .catch(function (error) { + //if session is inactive + loginRedirect(); + }) } render() {