Skip to content

Commit 491d07c

Browse files
chore: update callback page example
1 parent cdb5972 commit 491d07c

8 files changed

Lines changed: 16 additions & 56 deletions

File tree

examples/guard-angular/normal/src/app/pages/callback/callback.component.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ export class CallbackComponent {
2828
const loginStatus: JwtTokenStatus | undefined = await this.guard.client.checkLoginStatus()
2929

3030
if (!loginStatus) {
31-
this.guard.client.startWithRedirect({
32-
scope: 'openid profile'
33-
})
34-
return
31+
return console.error('Guard is not get login status')
3532
}
3633

3734
// 3. 获取到登录用户的用户信息
@@ -53,9 +50,7 @@ export class CallbackComponent {
5350
// 从 URL search 中解析 state
5451
} catch (e) {
5552
// 登录失败,推荐再次跳转到登录页面
56-
this.guard.client.startWithRedirect({
57-
scope: 'openid profile'
58-
})
53+
console.error('Guard handleAuthingLoginCallback error: ', e)
5954
}
6055
}
6156
}

examples/guard-nextjs-react18/pages/callback.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ export default function Callback() {
1919
const loginStatus = await guard.checkLoginStatus()
2020

2121
if (!loginStatus) {
22-
guard.startWithRedirect({
23-
scope: 'openid profile'
24-
})
25-
return
22+
return console.error('Guard is not get login status')
2623
}
2724

2825
// 3. 获取到登录用户的用户信息
@@ -42,9 +39,7 @@ export default function Callback() {
4239
// 从 URL search 中解析 state
4340
} catch (e) {
4441
// 登录失败,推荐再次跳转到登录页面
45-
guard.startWithRedirect({
46-
scope: 'openid profile'
47-
})
42+
console.error('Guard handleAuthingLoginCallback error: ', e)
4843
}
4944
}
5045

examples/guard-nextjs/pages/callback.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ export default function Home() {
1919
const loginStatus = await guard.checkLoginStatus()
2020

2121
if (!loginStatus) {
22-
guard.startWithRedirect({
23-
scope: 'openid profile'
24-
})
25-
return
22+
return console.error('Guard is not get login status')
2623
}
2724

2825
// 3. 获取到登录用户的用户信息
@@ -42,9 +39,7 @@ export default function Home() {
4239
// 从 URL search 中解析 state
4340
} catch (e) {
4441
// 登录失败,推荐再次跳转到登录页面
45-
guard.startWithRedirect({
46-
scope: 'openid profile'
47-
})
42+
console.error('Guard handleAuthingLoginCallback error: ', e)
4843
}
4944
}
5045

examples/guard-react/normal/src/pages/Callback.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ export default function Callback() {
1717
const loginStatus: JwtTokenStatus | undefined = await guard.checkLoginStatus()
1818

1919
if (!loginStatus) {
20-
guard.startWithRedirect({
21-
scope: 'openid profile'
22-
})
23-
return
20+
return console.error('Guard is not get login status')
2421
}
2522

2623
// 3. 获取到登录用户的用户信息
@@ -40,9 +37,7 @@ export default function Callback() {
4037
// 从 URL search 中解析 state
4138
} catch (e) {
4239
// 登录失败,推荐再次跳转到登录页面
43-
guard.startWithRedirect({
44-
scope: 'openid profile'
45-
})
40+
console.error('Guard handleAuthingLoginCallback error: ', e)
4641
}
4742
}
4843

examples/guard-react18/normal/src/pages/Callback.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ export default function Callback() {
1717
const loginStatus: JwtTokenStatus | undefined = await guard.checkLoginStatus()
1818

1919
if (!loginStatus) {
20-
guard.startWithRedirect({
21-
scope: 'openid profile'
22-
})
23-
return
20+
return console.error('Guard is not get login status')
2421
}
2522

2623
// 3. 获取到登录用户的用户信息
@@ -40,9 +37,7 @@ export default function Callback() {
4037
// 从 URL search 中解析 state
4138
} catch (e) {
4239
// 登录失败,推荐再次跳转到登录页面
43-
guard.startWithRedirect({
44-
scope: 'openid profile'
45-
})
40+
console.error('Guard handleAuthingLoginCallback error: ', e)
4641
}
4742
}
4843

examples/guard-vue2/normal/src/views/Callback.vue

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@ export default {
2626
const loginStatus = await this.$guard.checkLoginStatus()
2727
2828
if (!loginStatus) {
29-
this.$guard.startWithRedirect({
30-
scope: 'openid profile'
31-
})
32-
return
29+
return console.error('Guard is not get login status')
3330
}
3431
3532
// 3. 获取到登录用户的用户信息
@@ -49,9 +46,7 @@ export default {
4946
// 从 URL search 中解析 state
5047
} catch (e) {
5148
// 登录失败,推荐再次跳转到登录页面
52-
this.$guard.startWithRedirect({
53-
scope: 'openid profile'
54-
})
49+
console.error('Guard handleAuthingLoginCallback error: ', e)
5550
}
5651
}
5752
}

examples/guard-vue3/normal/src/views/Callback.vue

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ const handleAuthingLoginCallback = async () => {
2525
const loginStatus: JwtTokenStatus | undefined = await guard.checkLoginStatus()
2626
2727
if (!loginStatus) {
28-
guard.startWithRedirect({
29-
scope: 'openid profile'
30-
})
31-
return
28+
return console.error('Guard is not get login status')
3229
}
3330
3431
// 3. 获取到登录用户的用户信息
@@ -50,9 +47,7 @@ const handleAuthingLoginCallback = async () => {
5047
// 从 URL search 中解析 state
5148
} catch (e) {
5249
// 登录失败,推荐再次跳转到登录页面
53-
guard.startWithRedirect({
54-
scope: 'openid profile'
55-
})
50+
console.error('Guard handleAuthingLoginCallback error: ', e)
5651
}
5752
}
5853

examples/guard/normal/callback.html

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@
2727
const loginStatus = await guard.checkLoginStatus()
2828

2929
if (!loginStatus) {
30-
guard.startWithRedirect({
31-
scope: 'openid profile'
32-
})
33-
return
30+
return console.error('Guard is not get login status')
3431
}
3532

3633
// 3. 获取到登录用户的用户信息
@@ -50,9 +47,7 @@
5047
// 从 URL search 中解析 state
5148
} catch (e) {
5249
// 登录失败,推荐再次跳转到登录页面
53-
guard.startWithRedirect({
54-
scope: 'openid profile'
55-
})
50+
console.error('Guard handleAuthingLoginCallback error: ', e)
5651
}
5752
}
5853
</script>

0 commit comments

Comments
 (0)