wip
This commit is contained in:
parent
4a0be19607
commit
7d3f46c529
13 changed files with 137 additions and 828 deletions
26
src/stores/adminUsers.js
Normal file
26
src/stores/adminUsers.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { defineStore } from 'pinia'
|
||||
|
||||
export const useAdminUsersStore = defineStore('adminUsers', {
|
||||
state: () => ({
|
||||
users: new Map()
|
||||
}),
|
||||
getters: {
|
||||
getUser(state) {
|
||||
return (id) => state.users.get(id)
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
async fetchAdminUsers(opts) {
|
||||
const data = await window.vuex.state.api.backendInteractor.adminListUsers({
|
||||
opts,
|
||||
})
|
||||
|
||||
data.users.forEach((user) => {
|
||||
window.vuex.dispatch('fetchUserIfMissing', user.id),
|
||||
this.users.set(user.id, user)
|
||||
})
|
||||
|
||||
return data
|
||||
},
|
||||
},
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue