@pga/auth-flow-provider
Advanced tools
Comparing version 0.0.1-0 to 0.0.1-1
{ | ||
"name": "@pga/auth-flow-provider", | ||
"version": "0.0.1-0", | ||
"version": "0.0.1-1", | ||
"description": "PGA React Auth Provider Package for OneLogin's Authorization Flow", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -6,2 +6,3 @@ /* global fetch */ | ||
const ANONYMOUS_ROLE = 'ANONYMOUS' | ||
const SESSION_TIMEOUT_CHECK = 2 * 60 * 1000 | ||
@@ -17,5 +18,8 @@ const AuthContext = React.createContext() | ||
this.state = { authReady: false, isLoggedIn: false, me: null } | ||
this.sessionTimedId = null | ||
this.fetchSession = this.fetchSession.bind(this) | ||
} | ||
async componentDidMount () { | ||
async fetchSession () { | ||
const { apolloClient, query } = this.props | ||
@@ -47,2 +51,20 @@ const authReady = true | ||
async componentDidMount () { | ||
try { | ||
await this.fetchSession() | ||
} catch (err) { | ||
console.log(err) | ||
} | ||
this.sessionTimedId = setTimeout(this.fetchSession, SESSION_TIMEOUT_CHECK) | ||
console.log('this.sessionTimedId: ', this.sessionTimedId) | ||
} | ||
componentWillUnmount () { | ||
if (this.sessionTimedId) { | ||
clearTimeout(this.sessionTimedId) | ||
} | ||
} | ||
render () { | ||
@@ -49,0 +71,0 @@ const { authReady, isLoggedIn, me } = this.state |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30186
650