mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-19 19:31:54 +03:00
remove interval points screen
This commit is contained in:
parent
fc91ff9e1c
commit
c315b6038f
@ -49,14 +49,10 @@ const PointsContainer = ({
|
|||||||
const [balance, setBalance] = useState(0);
|
const [balance, setBalance] = useState(0);
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const fetchInterval = useCallback(() => setInterval(_fetchUserPointActivities, 6 * 60 * 1000), [
|
|
||||||
_fetchUserPointActivities,
|
|
||||||
]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isConnected) {
|
if (isConnected) {
|
||||||
_fetchUserPointActivities(username);
|
_fetchUserPointActivities(username);
|
||||||
fetchInterval();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get(navigation, 'state.params', null)) {
|
if (get(navigation, 'state.params', null)) {
|
||||||
@ -64,7 +60,7 @@ const PointsContainer = ({
|
|||||||
|
|
||||||
setNavigationParams(_navigationParams);
|
setNavigationParams(_navigationParams);
|
||||||
}
|
}
|
||||||
}, [_fetchUserPointActivities, fetchInterval, isConnected, navigation, username]);
|
}, [_fetchUserPointActivities, isConnected, navigation, username]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isConnected && activeBottomTab === ROUTES.TABBAR.WALLET && username) {
|
if (isConnected && activeBottomTab === ROUTES.TABBAR.WALLET && username) {
|
||||||
@ -72,10 +68,6 @@ const PointsContainer = ({
|
|||||||
}
|
}
|
||||||
}, [isConnected, username, _fetchUserPointActivities, activeBottomTab]);
|
}, [isConnected, username, _fetchUserPointActivities, activeBottomTab]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
return clearInterval(fetchInterval);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Component Functions
|
// Component Functions
|
||||||
|
|
||||||
const _handleOnDropdownSelected = index => {
|
const _handleOnDropdownSelected = index => {
|
||||||
@ -137,9 +129,9 @@ const PointsContainer = ({
|
|||||||
setRefreshing(true);
|
setRefreshing(true);
|
||||||
|
|
||||||
await getUser(_username)
|
await getUser(_username)
|
||||||
.then(userPoints => {
|
.then(userPointsP => {
|
||||||
const _balance = Math.round(get(userPoints, 'points') * 1000) / 1000;
|
const _balance = Math.round(get(userPointsP, 'points') * 1000) / 1000;
|
||||||
setUserPoints(userPoints);
|
setUserPoints(userPointsP);
|
||||||
setBalance(_balance);
|
setBalance(_balance);
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
@ -147,9 +139,9 @@ const PointsContainer = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
await getUserPoints(_username)
|
await getUserPoints(_username)
|
||||||
.then(userActivities => {
|
.then(userActivitiesP => {
|
||||||
if (Object.entries(userActivities).length !== 0) {
|
if (Object.entries(userActivitiesP).length !== 0) {
|
||||||
setUserActivities(_groomUserActivities(userActivities));
|
setUserActivities(_groomUserActivities(userActivitiesP));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
@ -185,7 +177,7 @@ const PointsContainer = ({
|
|||||||
.catch(error => {
|
.catch(error => {
|
||||||
if (error) {
|
if (error) {
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
`Fetching data from server failed, please try again or notify us at info@esteem.app \n${error.message.substr(
|
`Fetching failed, please try again or notify us at info@esteem.app \n${error.message.substr(
|
||||||
0,
|
0,
|
||||||
20,
|
20,
|
||||||
)}`,
|
)}`,
|
||||||
|
Loading…
Reference in New Issue
Block a user