Skip to content

Commit

Permalink
refactor: Allow delete user even if it's refreshing
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed Feb 19, 2024
1 parent 394c31e commit 27ffde7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 0 additions & 1 deletion xmcl-keystone-ui/src/views/UserMenuUserItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
<v-btn
text
color="red"
:disabled="refreshing"
@click="emit('remove')"
>
<v-icon
Expand Down
9 changes: 6 additions & 3 deletions xmcl-runtime/user/UserService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,13 @@ export class UserService extends StatefulService<UserState> implements IUserServ
this.refreshController = undefined
})

this.state.userProfile(newUser)
// Only update the user if the user is still in the state
if (this.state.users[userId]) {
this.state.userProfile(newUser)

if (newUser.invalidated) {
throw new UserException({ type: 'userAccessTokenExpired' })
if (newUser.invalidated) {
throw new UserException({ type: 'userAccessTokenExpired' })
}
}
}

Expand Down

0 comments on commit 27ffde7

Please sign in to comment.