wire up staff accounts with correct store data
This commit is contained in:
parent
b739edb509
commit
54f692622a
2 changed files with 6 additions and 8 deletions
|
@ -185,12 +185,9 @@ const getAppSecret = async ({ store }) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const resolveStaffAccounts = async ({ store, accounts }) => {
|
const resolveStaffAccounts = ({ store, accounts }) => {
|
||||||
const backendInteractor = store.state.api.backendInteractor
|
const nicknames = accounts.map(uri => uri.split('/').pop())
|
||||||
let nicknames = accounts.map(uri => uri.split('/').pop())
|
nicknames.map(nickname => store.dispatch('fetchUser', nickname))
|
||||||
.map(id => backendInteractor.fetchUser({ id }))
|
|
||||||
nicknames = await Promise.all(nicknames)
|
|
||||||
|
|
||||||
store.dispatch('setInstanceOption', { name: 'staffAccounts', value: nicknames })
|
store.dispatch('setInstanceOption', { name: 'staffAccounts', value: nicknames })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,7 +233,7 @@ const getNodeInfo = async ({ store }) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const accounts = metadata.staffAccounts
|
const accounts = metadata.staffAccounts
|
||||||
await resolveStaffAccounts({ store, accounts })
|
resolveStaffAccounts({ store, accounts })
|
||||||
} else {
|
} else {
|
||||||
throw (res)
|
throw (res)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import map from 'lodash/map'
|
||||||
import BasicUserCard from '../basic_user_card/basic_user_card.vue'
|
import BasicUserCard from '../basic_user_card/basic_user_card.vue'
|
||||||
|
|
||||||
const StaffPanel = {
|
const StaffPanel = {
|
||||||
|
@ -6,7 +7,7 @@ const StaffPanel = {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
staffAccounts () {
|
staffAccounts () {
|
||||||
return this.$store.state.instance.staffAccounts
|
return map(this.$store.state.instance.staffAccounts, nickname => this.$store.getters.findUser(nickname)).filter(_ => _)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue