diff --git a/apis/candidates.js b/apis/candidates.js
index 1c08db59..4432116a 100644
--- a/apis/candidates.js
+++ b/apis/candidates.js
@@ -741,13 +741,8 @@ router.put('/update', [
set['dataCenter.location'] = body.dcLocation
}
- if (body.website) {
- set['socials.website'] = body.website
- }
-
- if (body.telegram) {
- set['socials.telegram'] = body.telegram
- }
+ set['socials.website'] = body.website || ''
+ set['socials.telegram'] = body.telegram || ''
const address = await web3.eth.accounts.recover(message, signedMessage)
diff --git a/apis/voters.js b/apis/voters.js
index 7c215708..1abd632c 100644
--- a/apis/voters.js
+++ b/apis/voters.js
@@ -373,17 +373,20 @@ router.get('/calculatingReward1Day', [], async (req, res, next) => {
const capacity = new BigNumber(candidate.capacity).div(10 ** 18)
const totalReward = new BigNumber(config.get('blockchain.reward'))
// get total signers in latest epoch
- const totalSigners = await axios.post(
- urljoin(config.get('tomoscanUrl'), `api/expose/totalSignNumber/${epoch}`)
- )
+ let totalSigners
+ if (epoch) {
+ totalSigners = await axios.post(
+ urljoin(config.get('tomoscanUrl'), `api/expose/totalSignNumber/${epoch}`)
+ )
+ }
- if (totalSigners.data && totalSigners.data.totalSignNumber) {
+ if (totalSigners && totalSigners.data && totalSigners.data.totalSignNumber) {
// calculate devided reward
const masternodeReward = totalReward.multipliedBy(signNumber).dividedBy(totalSigners.data.totalSignNumber)
// calculate voter reward 1 day
- const estimateReward = masternodeReward
- .multipliedBy((amount.div(0.5))).div(capacity.plus(amount)).multipliedBy(await epochIn1Day) || 'N/A'
+ const estimateReward = masternodeReward.multipliedBy(0.5)
+ .multipliedBy(amount).div(capacity.plus(amount)).multipliedBy(await epochIn1Day) || 'N/A'
return res.send(estimateReward.toString(10))
}
return res.send('N/A')
diff --git a/app/components/candidates/Update.vue b/app/components/candidates/Update.vue
index 1126a04c..46628adb 100644
--- a/app/components/candidates/Update.vue
+++ b/app/components/candidates/Update.vue
@@ -68,6 +68,9 @@