mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2024-11-19 18:11:30 +01:00
fix: oldObj should not overwrite properties
This commit is contained in:
parent
a8d4835b74
commit
4b4f18fad5
@ -14,15 +14,14 @@ const retryWithDelay = async function (fn, retryCount = 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const mapCharge = (obj, oldObj = {}) => {
|
const mapCharge = (obj, oldObj = {}) => {
|
||||||
const charge = {...obj, ...oldObj}
|
const charge = {...oldObj, ...obj}
|
||||||
|
|
||||||
charge.progress = obj.time_left < 0 ? 1 : 1 - obj.time_left / obj.time
|
charge.progress = obj.time_left < 0 ? 1 : 1 - obj.time_left / obj.time
|
||||||
charge.time = minutesToTime(obj.time)
|
charge.time = minutesToTime(obj.time)
|
||||||
charge.timeLeft = minutesToTime(obj.time_left)
|
charge.timeLeft = minutesToTime(obj.time_left)
|
||||||
|
|
||||||
charge.expanded = false
|
|
||||||
charge.displayUrl = ['/satspay/', obj.id].join('')
|
charge.displayUrl = ['/satspay/', obj.id].join('')
|
||||||
charge.expanded = oldObj.expanded
|
charge.expanded = oldObj.expanded || false
|
||||||
charge.pendingBalance = oldObj.pendingBalance || 0
|
charge.pendingBalance = oldObj.pendingBalance || 0
|
||||||
return charge
|
return charge
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user