toggle shipped

This commit is contained in:
Tiago Vasconcelos 2022-12-30 12:00:16 +00:00
parent 301cfb25d9
commit 77051d2609
2 changed files with 5 additions and 3 deletions

View file

@ -1194,10 +1194,12 @@
}) })
}, },
shipOrder(order_id) { shipOrder(order_id) {
let shipped = this.orders.find(o => o.id == order_id).shipped
console.log(this.orders, order_id, shipped)
LNbits.api LNbits.api
.request( .request(
'GET', 'GET',
'/shop/api/v1/orders/shipped/' + order_id, `/shop/api/v1/orders/shipped/${order_id}?shipped=${!shipped}`,
this.g.user.wallets[0].inkey this.g.user.wallets[0].inkey
) )
.then(response => { .then(response => {

View file

@ -358,12 +358,12 @@ async def api_shop_order_pubkey(payment_hash: str, pubkey: str):
@shop_ext.get("/api/v1/orders/shipped/{order_id}") @shop_ext.get("/api/v1/orders/shipped/{order_id}")
async def api_shop_order_shipped( async def api_shop_order_shipped(
order_id, wallet: WalletTypeInfo = Depends(get_key_type) order_id, shipped: bool = Query(...), wallet: WalletTypeInfo = Depends(get_key_type)
): ):
await db.execute( await db.execute(
"UPDATE shop.orders SET shipped = ? WHERE id = ?", "UPDATE shop.orders SET shipped = ? WHERE id = ?",
( (
True, shipped,
order_id, order_id,
), ),
) )