Skip to content

Commit

Permalink
fix(backend): add incoming http tokens only if the array contains them
Browse files Browse the repository at this point in the history
  • Loading branch information
furkan-bilgin committed Sep 18, 2024
1 parent 825e11d commit bb3293e
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions packages/backend/src/payment-method/ilp/peer/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,16 @@ async function updatePeer(
return await Peer.transaction(deps.knex, async (trx) => {
if (options.http?.incoming) {
await deps.httpTokenService.deleteByPeer(options.id, trx)
const err = await addIncomingHttpTokens({
deps,
peerId: options.id,
tokens: options.http?.incoming?.authTokens,
trx
})
if (err) {
throw err
if (options.http?.incoming?.authTokens.length > 0) {
const err = await addIncomingHttpTokens({
deps,
peerId: options.id,
tokens: options.http?.incoming?.authTokens,
trx
})
if (err) {
throw err
}
}
}
return await Peer.query(trx)
Expand Down

0 comments on commit bb3293e

Please sign in to comment.