From fc427e7ccc940815a0904d0b0659f3b0f8231aea Mon Sep 17 00:00:00 2001 From: Lee Salminen Date: Sun, 14 Aug 2022 11:38:26 -0600 Subject: [PATCH] resolves issue #872 & #815, error deleting lnurlp/lnurlw links (#877) * resolves issue #872, error deleting lnurlp link * apply the same fix for lnurlw in issue #815 --- lnbits/extensions/lnurlp/views_api.py | 4 ++-- lnbits/extensions/withdraw/views_api.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lnbits/extensions/lnurlp/views_api.py b/lnbits/extensions/lnurlp/views_api.py index 97e8fd4c..f4ca505e 100644 --- a/lnbits/extensions/lnurlp/views_api.py +++ b/lnbits/extensions/lnurlp/views_api.py @@ -121,7 +121,7 @@ async def api_link_create_or_update( return {**link.dict(), "lnurl": link.lnurl(request)} -@lnurlp_ext.delete("/api/v1/links/{link_id}") +@lnurlp_ext.delete("/api/v1/links/{link_id}", status_code=HTTPStatus.OK) async def api_link_delete(link_id, wallet: WalletTypeInfo = Depends(get_key_type)): link = await get_pay_link(link_id) @@ -136,7 +136,7 @@ async def api_link_delete(link_id, wallet: WalletTypeInfo = Depends(get_key_type ) await delete_pay_link(link_id) - raise HTTPException(status_code=HTTPStatus.NO_CONTENT) + return {"success": True} @lnurlp_ext.get("/api/v1/rate/{currency}", status_code=HTTPStatus.OK) diff --git a/lnbits/extensions/withdraw/views_api.py b/lnbits/extensions/withdraw/views_api.py index 800fecce..e0d3e56f 100644 --- a/lnbits/extensions/withdraw/views_api.py +++ b/lnbits/extensions/withdraw/views_api.py @@ -113,7 +113,7 @@ async def api_link_create_or_update( return {**link.dict(), **{"lnurl": link.lnurl(req)}} -@withdraw_ext.delete("/api/v1/links/{link_id}") +@withdraw_ext.delete("/api/v1/links/{link_id}", status_code=HTTPStatus.OK) async def api_link_delete(link_id, wallet: WalletTypeInfo = Depends(require_admin_key)): link = await get_withdraw_link(link_id) @@ -128,7 +128,7 @@ async def api_link_delete(link_id, wallet: WalletTypeInfo = Depends(require_admi ) await delete_withdraw_link(link_id) - raise HTTPException(status_code=HTTPStatus.NO_CONTENT) + return {"success": True} @withdraw_ext.get("/api/v1/links/{the_hash}/{lnurl_id}", status_code=HTTPStatus.OK)