feat: add namedProfiles getter

This commit is contained in:
Ricardo Arturo Cabral Mejia 2022-01-30 02:11:46 +00:00
parent 1549959f0a
commit 8df90b1fc2
No known key found for this signature in database
GPG Key ID: 8949679922214342

View File

@ -1,5 +1,14 @@
import Identicon from 'identicon.js'
export function namedProfiles(state, getters) {
return Object.entries(state.profilesCache)
.reduce((result, [pubkey, profile]) => getters.hasName(pubkey)
? [...result, { ...profile, pubkey }] // [..., { name, pubkey, nip05, ...}, ...]
: result,
[]
)
}
export function hasName(state) {
return pubkey => {
let {name, nip05} = state.profilesCache[pubkey] || {}