mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-30 09:07:28 +03:00
added delay for server response WA
This commit is contained in:
parent
9a3b5b0399
commit
783a4fc39f
@ -192,7 +192,7 @@ export const getFollowSearch = (user, targetUser) => new Promise((resolve, rejec
|
||||
});
|
||||
});
|
||||
|
||||
export const getIsMuted = async (username, targetUsername) => {
|
||||
export const getIsMuted = async (targetUsername, username) => {
|
||||
let resp;
|
||||
|
||||
try {
|
||||
|
@ -76,7 +76,10 @@ class ProfileContainer extends Component {
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const {
|
||||
navigation, currentAccount, activeBottomTab, isLoggedIn,
|
||||
navigation,
|
||||
currentAccount,
|
||||
activeBottomTab,
|
||||
isLoggedIn,
|
||||
} = this.props;
|
||||
const currentUsername = currentAccount.name !== nextProps.currentAccount.name && nextProps.currentAccount.name;
|
||||
|
||||
@ -97,6 +100,10 @@ class ProfileContainer extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
clearInterval(this.fetchProfileTimer);
|
||||
}
|
||||
|
||||
_getReplies = async (user) => {
|
||||
const { isReverseHeader } = this.state;
|
||||
if (isReverseHeader) {
|
||||
@ -184,21 +191,25 @@ class ProfileContainer extends Component {
|
||||
_profileActionDone = (error = null) => {
|
||||
const { username } = this.state;
|
||||
|
||||
this.setState({
|
||||
isProfileLoading: false,
|
||||
});
|
||||
|
||||
if (error) {
|
||||
this.setState({
|
||||
error,
|
||||
});
|
||||
alert(error);
|
||||
} else {
|
||||
this._fetchProfile(username);
|
||||
/**
|
||||
* This follow code totally a work arround
|
||||
* Ceated for server response delay.
|
||||
*/
|
||||
this.fetchProfileTimer = setTimeout(() => {
|
||||
this._fetchProfile(username);
|
||||
}, 8000);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
_fetchProfile = async (username = null) => {
|
||||
const { isProfileLoading } = this.state;
|
||||
if (username) {
|
||||
const { isLoggedIn, currentAccount } = this.props;
|
||||
let isFollowing;
|
||||
@ -222,6 +233,12 @@ class ProfileContainer extends Component {
|
||||
follows = null;
|
||||
}
|
||||
|
||||
if (isProfileLoading) {
|
||||
this.setState({
|
||||
isProfileLoading: false,
|
||||
});
|
||||
}
|
||||
|
||||
this.setState({
|
||||
follows,
|
||||
isFollowing,
|
||||
|
Loading…
Reference in New Issue
Block a user