Skip to content

Commit 5ebde17

Browse files
authored
Fix typescript codecheck error
ERROR in .../node_modules/vue-oidc-client/vue2/src/vue-oidc-client.ts(375,22): 375:22 Object is possibly 'undefined'. > 375 | if (current && current.meta.authName === authName) { | ^ 376 | router.replace('/') 377 | return 378 | } Version: typescript 4.5.4
1 parent d26136f commit 5ebde17

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

vue2/src/vue-oidc-client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ export function createOidcAuth(
343343
function signInIfNecessary() {
344344
if (auth.myRouter) {
345345
const current = auth.myRouter.currentRoute
346-
if (current && current.meta.authName === authName) {
346+
if (current && current.meta && current.meta.authName === authName) {
347347
Log.debug(`${authName} auth page re-signin with ${defaultSignInType}`)
348348

349349
signInReal(defaultSignInType, { state: { current } })
@@ -372,7 +372,7 @@ export function createOidcAuth(
372372
function redirectAfterSignout(router: Router | null) {
373373
if (router) {
374374
const current = router.currentRoute
375-
if (current && current.meta.authName === authName) {
375+
if (current && current.meta && current.meta.authName === authName) {
376376
router.replace('/')
377377
return
378378
}

0 commit comments

Comments
 (0)