From 05c370aaf36536c811f725f0bfbf5cf58ca4f0f6 Mon Sep 17 00:00:00 2001 From: sara daqiq Date: Tue, 29 May 2018 14:27:47 -0700 Subject: [PATCH] if the session is already deleted when logout is called redirect to login page --- okta-hosted-login/src/Navbar.jsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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() {