From fab419d9743bd8b8e281b78016946f7d85d50138 Mon Sep 17 00:00:00 2001 From: Vlad Stan Date: Thu, 4 May 2023 12:22:27 +0300 Subject: [PATCH] fix: use singular for for `customer` entity --- static/components/direct-messages/direct-messages.js | 5 +++-- static/components/order-list/order-list.js | 2 +- views_api.py | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/static/components/direct-messages/direct-messages.js b/static/components/direct-messages/direct-messages.js index b295c19..d034fe1 100644 --- a/static/components/direct-messages/direct-messages.js +++ b/static/components/direct-messages/direct-messages.js @@ -58,7 +58,7 @@ async function directMessages(path) { try { const {data} = await LNbits.api.request( 'GET', - '/nostrmarket/api/v1/customers', + '/nostrmarket/api/v1/customer', this.inkey ) this.customers = data @@ -89,7 +89,7 @@ async function directMessages(path) { try { const {data} = await LNbits.api.request( 'POST', - '/nostrmarket/api/v1/customers', + '/nostrmarket/api/v1/customer', this.adminkey, { public_key: this.newPublicKey, @@ -97,6 +97,7 @@ async function directMessages(path) { unread_messages: 0 } ) + this.newPublicKey = null this.activePublicKey = data.public_key await this.selectActiveCustomer() } catch (error) { diff --git a/static/components/order-list/order-list.js b/static/components/order-list/order-list.js index f1c883d..c4539b3 100644 --- a/static/components/order-list/order-list.js +++ b/static/components/order-list/order-list.js @@ -227,7 +227,7 @@ async function orderList(path) { try { const {data} = await LNbits.api.request( 'GET', - '/nostrmarket/api/v1/customers', + '/nostrmarket/api/v1/customer', this.inkey ) this.customers = data diff --git a/views_api.py b/views_api.py index c48410f..daad678 100644 --- a/views_api.py +++ b/views_api.py @@ -799,7 +799,7 @@ async def api_create_message( ######################################## CUSTOMERS ######################################## -@nostrmarket_ext.get("/api/v1/customers") +@nostrmarket_ext.get("/api/v1/customer") async def api_get_customers( wallet: WalletTypeInfo = Depends(get_key_type), ) -> List[Customer]: @@ -821,7 +821,7 @@ async def api_get_customers( ) -@nostrmarket_ext.post("/api/v1/customers") +@nostrmarket_ext.post("/api/v1/customer") async def api_createcustomer( data: Customer, wallet: WalletTypeInfo = Depends(require_admin_key),