Skip to content

Commit

Permalink
make delegate and undelegate buttons show by fixing fetchFromUrl()
Browse files Browse the repository at this point in the history
  • Loading branch information
kwunyeung committed Sep 7, 2019
1 parent 6bb0c33 commit f0bef9f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions imports/api/accounts/server/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ Meteor.methods({
'accounts.getDelegation'(address, validator){
let url = `/staking/delegators/${address}/delegations/${validator}`;
let delegations = fetchFromUrl(url);
delegations = delegations && delegations.data;
delegations = delegations && delegations.data.result;
if (delegations && delegations.shares)
delegations.shares = parseFloat(delegations.shares);

url = `/staking/redelegations?delegator=${address}&validator_to=${validator}`;
let relegations = fetchFromUrl(url).data;
relegations = relegations && relegations.data;
let relegations = fetchFromUrl(url);
relegations = relegations && relegations.data.result;
let completionTime;
if (relegations) {
relegations.forEach((relegation) => {
Expand All @@ -134,7 +134,7 @@ Meteor.methods({

url = `/staking/delegators/${address}/unbonding_delegations/${validator}`;
let undelegations = fetchFromUrl(url);
undelegations = undelegations && undelegations.data;
undelegations = undelegations && undelegations.data.result;
if (undelegations) {
delegations.unbonding = undelegations.entries.length;
delegations.unbondingCompletionTime = undelegations.entries[0].completion_time;
Expand Down

0 comments on commit f0bef9f

Please sign in to comment.