Skip to content

Commit

Permalink
Merge pull request #62 from lnbits/refactor
Browse files Browse the repository at this point in the history
refactor
  • Loading branch information
arcbtc authored Feb 8, 2024
2 parents f981e7e + 21d23c4 commit e5e97ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
20 changes: 8 additions & 12 deletions templates/tpos/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -859,17 +859,13 @@ <h6 class="text-subtitle1 q-my-none">
},
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: {
Expand Down Expand Up @@ -952,7 +948,7 @@ <h6 class="text-subtitle1 q-my-none">
},
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()
Expand Down
2 changes: 1 addition & 1 deletion views_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,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()
Expand Down

0 comments on commit e5e97ad

Please sign in to comment.