Skip to content
Snippets Groups Projects
Commit 7a049b1d authored by Quoc Huy Nguyen Dinh's avatar Quoc Huy Nguyen Dinh
Browse files

Defaulting post_voting_power to 0 if missing from API response

parent fb249eac
No related branches found
No related tags found
1 merge request!109Defaulting post_voting_power to 0 if missing from API response
import { api } from '@hiveio/hive-js'; import { api } from '@hiveio/hive-js';
import _ from 'lodash';
import { ifHive } from 'app/utils/Community'; import { ifHive } from 'app/utils/Community';
import stateCleaner from 'app/redux/stateCleaner'; import stateCleaner from 'app/redux/stateCleaner';
import { import {
...@@ -28,8 +29,11 @@ export function getHivePowerForUser(account) { ...@@ -28,8 +29,11 @@ export function getHivePowerForUser(account) {
'database_api.find_accounts', 'database_api.find_accounts',
{ accounts: [account] } { accounts: [account] }
); );
const post_voting_power = const post_voting_power = _.get(
fullAccounts['accounts'][0]['post_voting_power']; fullAccounts,
'accounts[0].post_voting_power',
0
);
/** /**
* This magic number is coming from * This magic number is coming from
* https://gitlab.syncad.com/hive/hivemind/-/blame/d2d5ef25107908db09438da5ee3da9d6fcb976bc/hive/server/bridge_api/objects.py * https://gitlab.syncad.com/hive/hivemind/-/blame/d2d5ef25107908db09438da5ee3da9d6fcb976bc/hive/server/bridge_api/objects.py
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment