fix: remove invitation after revocation

This commit is contained in:
Phan An 2023-08-23 23:46:44 +02:00
parent 55e11daf49
commit 39931bf2ae
No known key found for this signature in database
GPG key ID: A81E4477F0BB6FDC
2 changed files with 10 additions and 3 deletions

View file

@ -13,5 +13,8 @@ export const invitationService = {
users.forEach(user => userStore.add(user)) users.forEach(user => userStore.add(user))
}, },
revoke: async (user: User) => await http.delete(`invitations`, { email: user.email }) revoke: async (user: User) => {
await http.delete(`invitations`, { email: user.email })
userStore.remove(user)
}
} }

View file

@ -85,8 +85,7 @@ export const userStore = {
async destroy (user: User) { async destroy (user: User) {
await http.delete(`users/${user.id}`) await http.delete(`users/${user.id}`)
this.state.users = differenceBy(this.state.users, [user], 'id') this.remove(user)
this.vault.delete(user.id)
// Mama, just killed a man // Mama, just killed a man
// Put a gun against his head // Put a gun against his head
@ -106,5 +105,10 @@ export const userStore = {
// Mama, oooh // Mama, oooh
// I don't want to die // I don't want to die
// I sometimes wish I'd never been born at all // I sometimes wish I'd never been born at all
},
remove (user: User) {
this.state.users = differenceBy(this.state.users, [user], 'id')
this.vault.delete(user.id)
} }
} }