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="row items-center no-wrap q-mb-md">
<div class="col q-pr-lg"> <div class="col q-pr-lg">
<q-btn <q-btn
@click="stallDialog.show = true" @click="openCreateStallDialog"
unelevated unelevated
color="green" color="green"
class="float-left" class="float-left"
@ -142,7 +142,11 @@
<q-btn <q-btn
unelevated unelevated
color="primary" 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" type="submit"
>Create Stall</q-btn >Create Stall</q-btn
> >

View file

@ -35,7 +35,6 @@ async function stallList(path) {
}) })
}, },
createStall: async function (stall) { createStall: async function (stall) {
console.log('### createStall', stall)
try { try {
const {data} = await LNbits.api.request( const {data} = await LNbits.api.request(
'POST', 'POST',
@ -43,6 +42,11 @@ async function stallList(path) {
this.adminkey, this.adminkey,
stall stall
) )
this.stallDialog.show = false
this.$q.notify({
type: 'positive',
message: 'Stall created!'
})
} catch (error) { } catch (error) {
LNbits.utils.notifyApiError(error) LNbits.utils.notifyApiError(error)
} }
@ -74,6 +78,17 @@ async function stallList(path) {
} catch (error) { } catch (error) {
LNbits.utils.notifyApiError(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 () { created: async function () {