feat: init merchant
This commit is contained in:
parent
2832ee928c
commit
99492b36c8
6 changed files with 164 additions and 8 deletions
|
|
@ -1,15 +1,52 @@
|
|||
const stalls = async () => {
|
||||
const merchant = async () => {
|
||||
Vue.component(VueQrcode.name, VueQrcode)
|
||||
|
||||
await stallDetails('static/components/stall-details/stall-details.html')
|
||||
|
||||
const nostr = window.NostrTools
|
||||
|
||||
new Vue({
|
||||
el: '#vue',
|
||||
mixins: [windowMixin],
|
||||
data: function () {
|
||||
return {}
|
||||
return {
|
||||
merchant: null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
generateKeys: async function () {
|
||||
const privkey = nostr.generatePrivateKey()
|
||||
const pubkey = nostr.getPublicKey(privkey)
|
||||
|
||||
const data = {private_key: privkey, public_key: pubkey, config: {}}
|
||||
try {
|
||||
const resp = await LNbits.api.request(
|
||||
'POST',
|
||||
'/nostrmarket/api/v1/merchant',
|
||||
this.g.user.wallets[0].adminkey,
|
||||
data
|
||||
)
|
||||
} catch (error) {
|
||||
LNbits.utils.notifyApiError(error)
|
||||
}
|
||||
},
|
||||
getMerchant: async function () {
|
||||
try {
|
||||
const {data} = await LNbits.api.request(
|
||||
'get',
|
||||
'/nostrmarket/api/v1/merchant',
|
||||
this.g.user.wallets[0].adminkey
|
||||
)
|
||||
this.merchant = data
|
||||
} catch (error) {
|
||||
LNbits.utils.notifyApiError(error)
|
||||
}
|
||||
}
|
||||
},
|
||||
created: async function () {
|
||||
await this.getMerchant()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
stalls()
|
||||
merchant()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue