Skip to content

Commit 0401fdf

Browse files
committed
refactor: reduce redundant code
1 parent 6a89d34 commit 0401fdf

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

src/router/index.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,10 @@ router.beforeEach(async (to: EnhancedRouteLocation, _from, next) => {
3030
// Route cache
3131
routeCacheStore.addRoute(to)
3232

33-
if (isLogin()) {
34-
if (!userStore.userInfo?.uid) {
35-
await userStore.info()
36-
next()
37-
}
38-
39-
else {
40-
next()
41-
}
42-
}
43-
else {
44-
next()
45-
}
33+
if (isLogin() && !userStore.userInfo?.uid)
34+
await userStore.info()
35+
36+
next()
4637
})
4738

4839
router.afterEach(() => {

0 commit comments

Comments
 (0)