Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
],
"engines": {
"node": ">=16.13.1"
},
"devDependencies": {
"minimist": "^1.2.6"
}
}
2 changes: 2 additions & 0 deletions packages/guard/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/**/*
node_module/**/*
2 changes: 1 addition & 1 deletion packages/guard/components/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ export class Guard {
evt: T,
handler: Exclude<GuardEventsKebabToCamelType[T], undefined>
) {
;(this.eventListeners as any)[evt].push(handler as any)
; (this.eventListeners as any)[evt].push(handler as any)
}

show() {
Expand Down
7 changes: 4 additions & 3 deletions packages/guard/example/src/pages/Callback.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React, { useEffect } from 'react'
import { useHistory } from 'react-router-dom'

import { Guard } from '../../../components'
import { Guard } from '@authing/guard'
import "@authing/guard/dist/guard.css"

export default function Callback () {
export default function Callback() {
const history = useHistory()

const handleCallback = async () => {
Expand All @@ -12,7 +13,7 @@ export default function Callback () {
host: 'https://test0123456.authing.cn',
redirectUri: 'http://localhost:3000/callback'
})

await guard.handleRedirectCallback()
history.push('/personal')
}
Expand Down
5 changes: 3 additions & 2 deletions packages/guard/example/src/pages/Jump.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react'
import { Guard } from '../../../components'
import { Guard } from '@authing/guard'

export default function Jump () {

export default function Jump() {
const guard = new Guard({
appId: '62e752f0d8c681db4ed3f743',
host: 'https://test0123456.authing.cn',
Expand Down
6 changes: 3 additions & 3 deletions packages/guard/example/src/pages/Login.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useEffect } from 'react'
import { Guard } from '@authing/guard'

import { Guard } from '../../../components'

export default function Login () {
// import "@authing/guard/css"
export default function Login() {
const effects = async () => {
const guard = new Guard({
appId: '62e752f0d8c681db4ed3f743',
Expand Down
7 changes: 3 additions & 4 deletions packages/guard/example/src/pages/Personal.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import React, { useState } from 'react'
import { Guard } from '@authing/guard'

import { Guard } from '../../../components'

export default function Personal () {
export default function Personal() {
const [userInfo, setUserInfo] = useState('')

const guard = new Guard({
appId: '62e752f0d8c681db4ed3f743',
host: 'https://test0123456.authing.cn',
redirectUri: 'http://localhost:3000/callback'
})

guard.trackSession().then(res => {
console.log('trackSession res: ', res)
setUserInfo(JSON.stringify(res, null, 2))
Expand Down
Loading