Skip to content

Commit

Permalink
Merge pull request #246 from Authing/fix-trackSession-20230721
Browse files Browse the repository at this point in the history
Fix track session 20230721
  • Loading branch information
zhaoyiming0803 authored Jul 21, 2023
2 parents 506bd29 + cfd8c04 commit 683ab5d
Show file tree
Hide file tree
Showing 22 changed files with 99 additions and 76 deletions.
54 changes: 27 additions & 27 deletions examples/guard-nextjs-react18/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/guard-nextjs-react18/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@authing/guard-react18": "^5.2.2-alpha.0",
"@authing/guard-react18": "^5.2.3-alpha.0",
"@types/node": "18.11.9",
"@types/react": "18.0.24",
"@types/react-dom": "18.0.8",
Expand Down
13 changes: 13 additions & 0 deletions examples/guard-nextjs-react18/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
import Head from 'next/head'

import { useEffect } from 'react'

import { Guard } from '@authing/guard-react18'

import { guardOptions } from '../config'

export default function Home () {
const guard = new Guard(guardOptions)
const toEmbed = () => window.location.href = '/login'
const toJump = () => window.location.href = '/jump'

useEffect(() => {
guard.trackSession().then(userInfo => {
console.log('userInfo in index trackSession: ', userInfo)
})
}, [])

return <div>
<div style={{marginBottom: '20px'}} onClick={toEmbed}><button>嵌入模式</button></div>
<div><button onClick={toJump}>跳转模式</button></div>
Expand Down
46 changes: 23 additions & 23 deletions examples/guard-react18/normal/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/guard-react18/normal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"webpack-merge": "^4.2.1"
},
"dependencies": {
"@authing/guard-react18": "^5.2.1",
"@authing/guard-react18": "^5.2.3-alpha.0",
"antd": "^4.24.0",
"face-api.js": "^0.22.2",
"react": "^18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"packages/*"
],
"useWorkspaces": true,
"version": "5.2.2"
"version": "5.2.3-alpha.0"
}
2 changes: 1 addition & 1 deletion packages/guard-angular/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/guard-angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@authing/guard-angular",
"version": "5.2.2",
"version": "5.2.3-alpha.0",
"description": "Guard for Angular",
"module": "dist/fesm2015/authing-guard-angular.mjs",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -33,7 +33,7 @@
"@angular/core": "^14.0.0"
},
"dependencies": {
"@authing/guard": "^5.2.2"
"@authing/guard": "^5.2.3-alpha.0"
},
"author": "https://github.com/authing",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/guard-react/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/guard-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@authing/guard-react",
"version": "5.2.2",
"version": "5.2.3-alpha.0",
"description": "Guard for React",
"module": "dist/esm/guard.min.js",
"types": "dist/typings/index.d.ts",
Expand All @@ -24,7 +24,7 @@
"webpack": "^5.72.0"
},
"dependencies": {
"@authing/guard": "^5.2.2",
"@authing/guard": "^5.2.3-alpha.0",
"react": "^16.13.1"
},
"author": "https://github.com/authing",
Expand Down
2 changes: 1 addition & 1 deletion packages/guard-react18/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/guard-react18/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@authing/guard-react18",
"version": "5.2.2",
"version": "5.2.3-alpha.0",
"description": "Guard for React18",
"module": "dist/esm/guard.min.js",
"types": "dist/typings/index.d.ts",
Expand All @@ -25,7 +25,7 @@
"webpack": "^5.72.0"
},
"dependencies": {
"@authing/guard-shim-react18": "^5.2.2",
"@authing/guard-shim-react18": "^5.2.3-alpha.0",
"react": "^18.0.0"
},
"author": "https://github.com/authing",
Expand Down
2 changes: 1 addition & 1 deletion packages/guard-shim-react18/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/guard-shim-react18/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@authing/guard-shim-react18",
"version": "5.2.2",
"version": "5.2.3-alpha.0",
"description": "Guard shim for react18",
"module": "dist/esm/guard.min.js",
"types": "dist/typings/index.d.ts",
Expand Down
9 changes: 7 additions & 2 deletions packages/guard-shim-react18/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -454,10 +454,15 @@ export class Guard {
const authClient = await this.getAuthClient()

const idToken =
authClient.tokenProvider.getToken() || localStorage.getItem('idToken')
authClient.tokenProvider.getToken() ||
localStorage.getItem('idToken') ||
''

if (!idToken) {
return null
const user = await authClient.getCurrentUser()
if (user) {
return user
}
}

const publicConfig = await this.then()
Expand Down
2 changes: 1 addition & 1 deletion packages/guard-vue2/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/guard-vue2/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@authing/guard-vue2",
"version": "5.2.2",
"version": "5.2.3-alpha.0",
"description": "Guard for Vue2",
"module": "dist/esm/guard.min.js",
"types": "dist/typings/index.d.ts",
Expand All @@ -23,7 +23,7 @@
"webpack": "^5.72.0"
},
"dependencies": {
"@authing/guard": "^5.2.2",
"@authing/guard": "^5.2.3-alpha.0",
"vue": "^2.6.10"
},
"author": "https://github.com/authing",
Expand Down
2 changes: 1 addition & 1 deletion packages/guard-vue3/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 683ab5d

Please sign in to comment.