Skip to content

Commit

Permalink
fix: Should select first user if selected user is removed
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed Feb 19, 2024
1 parent 63a7a61 commit 8c89d93
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions xmcl-keystone-ui/src/composables/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ export function useUserContext() {
selectedUserId.value = id
}

watch(userProfile, (profile) => {
if (profile === NO_USER_PROFILE) {
// Select the first user
const first = users.value[0]
if (first) {
select(first.id)
}
}
})

return {
users,
isValidating,
Expand Down
2 changes: 2 additions & 0 deletions xmcl-keystone-ui/src/views/AppLoginForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
:error-messages="errorMessage"
@input="error = undefined"
@keypress="error = undefined"
@keypress.enter="onLogin"
/>
<v-text-field
v-if="!isOffline"
Expand Down Expand Up @@ -79,6 +80,7 @@
<v-btn
block
:loading="isLogining && (!hovered)"
:disabled="!data.username"
color="primary"
rounded
large
Expand Down

0 comments on commit 8c89d93

Please sign in to comment.