feat: show customer names

This commit is contained in:
Vlad Stan 2023-03-27 17:36:08 +03:00
parent 89f46fff35
commit a719517b9c
5 changed files with 19 additions and 38 deletions

View file

@ -9,7 +9,7 @@
<q-card-section>
<q-select
v-model="activePublicKey"
:options="customersPublicKeys.map(k => ({label: `${k.slice(0, 16)}...${k.slice(k.length - 16)}`, value: k}))"
:options="customers.map(c => ({label: `${c.profile.name || 'unknown'} ${c.profile.about || ''} (${c.public_key.slice(0, 16)}...${c.public_key.slice(c.public_key.length - 16)})`, value: c.public_key}))"
label="Select Customer"
emit-value
@input="selectActiveCustomer()"

View file

@ -12,7 +12,7 @@ async function directMessages(path) {
},
data: function () {
return {
customersPublicKeys: [],
customers: [],
messages: [],
newMessage: ''
}
@ -40,14 +40,15 @@ async function directMessages(path) {
LNbits.utils.notifyApiError(error)
}
},
getCustomersPublicKeys: async function () {
getCustomers: async function () {
try {
const {data} = await LNbits.api.request(
'GET',
'/nostrmarket/api/v1/customers',
this.inkey
)
this.customersPublicKeys = data
this.customers = data
console.log('### customers', this.customers)
} catch (error) {
LNbits.utils.notifyApiError(error)
}
@ -85,7 +86,7 @@ async function directMessages(path) {
}
},
created: async function () {
await this.getCustomersPublicKeys()
await this.getCustomers()
}
})
}