feat: create stall

This commit is contained in:
Vlad Stan 2023-03-01 11:46:21 +02:00
parent e9b7494bb6
commit aa10f639b5
2 changed files with 22 additions and 3 deletions

View file

@ -2,7 +2,7 @@
<div class="row items-center no-wrap q-mb-md">
<div class="col q-pr-lg">
<q-btn
@click="stallDialog.show = true"
@click="openCreateStallDialog"
unelevated
color="green"
class="float-left"
@ -142,7 +142,11 @@
<q-btn
unelevated
color="primary"
:disable="stallDialog.data.wallet == null"
:disable="!stallDialog.data.name
|| !stallDialog.data.currency
|| !stallDialog.data.wallet
|| !stallDialog.data.shippingZones
|| !stallDialog.data.shippingZones.length"
type="submit"
>Create Stall</q-btn
>

View file

@ -35,7 +35,6 @@ async function stallList(path) {
})
},
createStall: async function (stall) {
console.log('### createStall', stall)
try {
const {data} = await LNbits.api.request(
'POST',
@ -43,6 +42,11 @@ async function stallList(path) {
this.adminkey,
stall
)
this.stallDialog.show = false
this.$q.notify({
type: 'positive',
message: 'Stall created!'
})
} catch (error) {
LNbits.utils.notifyApiError(error)
}
@ -74,6 +78,17 @@ async function stallList(path) {
} catch (error) {
LNbits.utils.notifyApiError(error)
}
},
openCreateStallDialog: async function () {
await this.getCurrencies()
await this.getZones()
this.stallDialog.data = {
name: '',
wallet: null,
currency: 'sat',
shippingZones: []
}
this.stallDialog.show = true
}
},
created: async function () {