mirror of
https://github.com/styppo/hamstr.git
synced 2024-10-18 13:33:22 +00:00
feat: add namedProfiles getter
This commit is contained in:
parent
1549959f0a
commit
8df90b1fc2
@ -1,5 +1,14 @@
|
|||||||
import Identicon from 'identicon.js'
|
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) {
|
export function hasName(state) {
|
||||||
return pubkey => {
|
return pubkey => {
|
||||||
let {name, nip05} = state.profilesCache[pubkey] || {}
|
let {name, nip05} = state.profilesCache[pubkey] || {}
|
||||||
|
Loading…
Reference in New Issue
Block a user