mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-01 00:43:12 +03:00
get from dsteem user data
This commit is contained in:
parent
00ea600774
commit
43a230a86a
@ -38,9 +38,7 @@ export const getUserData = () => new Promise((resolve, reject) => {
|
||||
|
||||
export const getUserDataWithUsername = (username) => {
|
||||
try {
|
||||
const user = Array.from(
|
||||
realm.objects(USER_SCHEMA).filtered('username = $0', username),
|
||||
);
|
||||
const user = Array.from(realm.objects(USER_SCHEMA).filtered('username = $0', username));
|
||||
return user;
|
||||
} catch (error) {
|
||||
return error;
|
||||
@ -66,9 +64,7 @@ export const setUserData = userData => new Promise((resolve, reject) => {
|
||||
|
||||
export const updateUserData = userData => new Promise((resolve, reject) => {
|
||||
try {
|
||||
const account = realm
|
||||
.objects(USER_SCHEMA)
|
||||
.filtered('username = $0', userData.username);
|
||||
const account = realm.objects(USER_SCHEMA).filtered('username = $0', userData.username);
|
||||
|
||||
if (Array.from(account).length > 0) {
|
||||
realm.write(() => {
|
||||
|
@ -5,10 +5,9 @@ import { ProfileScreen } from '..';
|
||||
|
||||
// Utilitites
|
||||
import {
|
||||
getUser, getFollows, getPosts, getUserComments,
|
||||
getFollows, getPosts, getUser, getUserComments,
|
||||
} from '../../../providers/steem/dsteem';
|
||||
import { getUserData, getAuthStatus, getUserDataWithUsername } from '../../../realm/realm';
|
||||
import { getFormatedCreatedDate } from '../../../utils/time';
|
||||
import { getUserData, getAuthStatus } from '../../../realm/realm';
|
||||
|
||||
class ProfileContainer extends Component {
|
||||
constructor(props) {
|
||||
@ -43,12 +42,12 @@ class ProfileContainer extends Component {
|
||||
});
|
||||
|
||||
if (selectedUser) {
|
||||
const _userData = getUserDataWithUsername(selectedUser.username);
|
||||
const _userData = await getUser(selectedUser.username);
|
||||
console.log(selectedUser);
|
||||
|
||||
console.log('holllyy');
|
||||
console.log(_userData);
|
||||
userData = _userData && _userData[0];
|
||||
userData = _userData;
|
||||
} else if (isLoggedIn) {
|
||||
await getUserData().then((res) => {
|
||||
userData = Array.from(res)[0];
|
||||
@ -64,7 +63,7 @@ class ProfileContainer extends Component {
|
||||
follows = res;
|
||||
});
|
||||
|
||||
user = await getUser(userData.username);
|
||||
user = await getUser(userData.username || selectedUser.username);
|
||||
|
||||
about = user.json_metadata && JSON.parse(user.json_metadata);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user