using local data from otherAccounts instead of realm, comparing by username instead of name

This commit is contained in:
Nouman Tahir 2023-01-24 22:49:12 +05:00
parent f4c5c6ac2d
commit ac63562e9c

View File

@ -7,7 +7,6 @@ import { injectIntl } from 'react-intl';
import { useNavigation } from '@react-navigation/native';
import { promote, boost, isPostAvailable } from '../providers/hive/dhive';
import { toastNotification } from '../redux/actions/uiAction';
import { getUserDataWithUsername } from '../realm/realm';
/*
* Props Name Description Value
@ -88,7 +87,7 @@ class RedeemContainer extends Component {
};
_handleOnSubmit = async (redeemType, actionSpecificParam, fullPermlink, selectedUser) => {
const { intl, currentAccount } = this.props;
const { intl, currentAccount, accounts } = this.props;
const separatedPermlink = fullPermlink.split('/');
const _author = get(separatedPermlink, '[0]');
const _permlink = get(separatedPermlink, '[1]');
@ -99,18 +98,7 @@ class RedeemContainer extends Component {
return;
}
let userFromRealm;
if (selectedUser) {
userFromRealm = await getUserDataWithUsername(selectedUser);
}
const user = userFromRealm
? {
name: selectedUser,
local: userFromRealm[0],
}
: currentAccount;
const user = selectedUser !== currentAccount.username ? currentAccount : accounts.find(item=>item.username === selectedUser);
this._redeemAction(redeemType, actionSpecificParam, _permlink, _author, user);
};