Skip to content

Commit

Permalink
fix: Should let user login if there is no user
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed May 4, 2023
1 parent 779d0f4 commit 8be4f0f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions xmcl-keystone-ui/src/views/AppSystemBarUser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import { BaseServiceKey, UserServiceKey } from '@xmcl/runtime-api'
import UserMenu from './UserMenu.vue'
const { users, userProfile: selectedUser, gameProfile: selectedUserGameProfile } = injection(kUserContext)
const { selectUser, removeUserProfile, abortRefresh, refreshUser } = useService(UserServiceKey)
const { selectUser, abortRefresh, refreshUser } = useService(UserServiceKey)
const { show: showLoginDialog } = useDialog(LoginDialog)
const isShown = ref(false)
Expand All @@ -54,9 +54,13 @@ const onSelectUser = (user: string) => {
selectUser(user)
}
function onRefresh() {
refreshUser().catch(() => {
showLoginDialog({ username: selectedUser.value?.username, service: selectedUser.value?.authService, error: t('login.userRelogin') })
})
if (users.value.length === 0) {
showLoginDialog()
} else {
refreshUser().catch(() => {
showLoginDialog({ username: selectedUser.value?.username, service: selectedUser.value?.authService, error: t('login.userRelogin') })
})
}
}
provide(UserSkinRenderPaused, computed(() => !isShown.value))
Expand Down

0 comments on commit 8be4f0f

Please sign in to comment.