Skip to content

Commit e5e97ad

Browse files
authored
Merge pull request #62 from lnbits/refactor
refactor
2 parents f981e7e + 21d23c4 commit e5e97ad

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

templates/tpos/index.html

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -859,17 +859,13 @@ <h6 class="text-subtitle1 q-my-none">
859859
},
860860
computed: {
861861
categoryList() {
862-
return this.tposs.reduce((acc, tpos) => {
863-
tpos.items.forEach(item => {
864-
item.categories &&
865-
item.categories.forEach(category => {
866-
if (!acc.includes(category)) {
867-
acc.push(category)
868-
}
869-
})
870-
})
871-
return acc
872-
}, [])
862+
return Array.from(
863+
new Set(
864+
this.tposs.flatMap(tpos =>
865+
tpos.items.flatMap(item => item.categories || [])
866+
)
867+
)
868+
)
873869
}
874870
},
875871
methods: {
@@ -952,7 +948,7 @@ <h6 class="text-subtitle1 q-my-none">
952948
},
953949
createTPoS(wallet, data) {
954950
LNbits.api
955-
.request('POST', '/tpos/api/v1/tposs', wallet.inkey, data)
951+
.request('POST', '/tpos/api/v1/tposs', wallet.adminkey, data)
956952
.then(response => {
957953
this.tposs.push(mapTPoS(response.data))
958954
this.closeFormDialog()

views_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ async def api_tposs(
4545

4646
@tpos_ext.post("/api/v1/tposs", status_code=HTTPStatus.CREATED)
4747
async def api_tpos_create(
48-
data: CreateTposData, wallet: WalletTypeInfo = Depends(get_key_type)
48+
data: CreateTposData, wallet: WalletTypeInfo = Depends(require_admin_key)
4949
):
5050
tpos = await create_tpos(wallet_id=wallet.wallet.id, data=data)
5151
return tpos.dict()

0 commit comments

Comments
 (0)