diff --git a/templates/tpos/index.html b/templates/tpos/index.html
index f0c8ceb..2c63aa0 100644
--- a/templates/tpos/index.html
+++ b/templates/tpos/index.html
@@ -859,17 +859,13 @@
},
computed: {
categoryList() {
- return this.tposs.reduce((acc, tpos) => {
- tpos.items.forEach(item => {
- item.categories &&
- item.categories.forEach(category => {
- if (!acc.includes(category)) {
- acc.push(category)
- }
- })
- })
- return acc
- }, [])
+ return Array.from(
+ new Set(
+ this.tposs.flatMap(tpos =>
+ tpos.items.flatMap(item => item.categories || [])
+ )
+ )
+ )
}
},
methods: {
@@ -952,7 +948,7 @@
},
createTPoS(wallet, data) {
LNbits.api
- .request('POST', '/tpos/api/v1/tposs', wallet.inkey, data)
+ .request('POST', '/tpos/api/v1/tposs', wallet.adminkey, data)
.then(response => {
this.tposs.push(mapTPoS(response.data))
this.closeFormDialog()
diff --git a/views_api.py b/views_api.py
index e68f071..d227b28 100644
--- a/views_api.py
+++ b/views_api.py
@@ -47,7 +47,7 @@ async def api_tposs(
@tpos_ext.post("/api/v1/tposs", status_code=HTTPStatus.CREATED)
async def api_tpos_create(
- data: CreateTposData, wallet: WalletTypeInfo = Depends(get_key_type)
+ data: CreateTposData, wallet: WalletTypeInfo = Depends(require_admin_key)
):
tpos = await create_tpos(wallet_id=wallet.wallet.id, data=data)
return tpos.dict()