axios query params fix

This commit is contained in:
Tiago vasconcelos
2021-10-08 11:03:55 +01:00
parent 0a85bae405
commit 7b93299ef7
2 changed files with 5 additions and 7 deletions

View File

@@ -206,11 +206,12 @@
var dialog = this.invoiceDialog
console.log(this.sat, this.tposId)
axios
.post('/tpos/api/v1/tposs/' + this.tposId + '/invoices', {
.post('/tpos/api/v1/tposs/' + this.tposId + '/invoices', null, {
params: {
amount: this.sat
}
})
.then(function (response) {
console.log(response.data)
dialog.data = response.data
dialog.show = true

View File

@@ -57,10 +57,8 @@ async def api_tpos_delete(tpos_id: str, wallet: WalletTypeInfo = Depends(get_key
raise HTTPException(status_code=HTTPStatus.NO_CONTENT)
# return "", HTTPStatus.NO_CONTENT
@tpos_ext.post("/api/v1/tposs/{tpos_id}/invoices", status_code=HTTPStatus.CREATED)
async def api_tpos_create_invoice(amount: int = Query(..., ge=1), tpos_id: str = None):
print("TPOS", tpos_id, amount)
tpos = await get_tpos(tpos_id)
if not tpos:
@@ -78,13 +76,12 @@ async def api_tpos_create_invoice(amount: int = Query(..., ge=1), tpos_id: str =
extra={"tag": "tpos"},
)
except Exception as e:
print("ERROR", e)
raise HTTPException(
status_code=HTTPStatus.INTERNAL_SERVER_ERROR,
detail=str(e)
)
# return {"message": str(e)}, HTTPStatus.INTERNAL_SERVER_ERROR
print("INV", payment_hash)
return {"payment_hash": payment_hash, "payment_request": payment_request}