mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-23 05:13:04 +03:00
remove interval points screen
This commit is contained in:
parent
a698687b02
commit
2bdcec4e24
@ -49,14 +49,10 @@ const PointsContainer = ({
|
||||
const [balance, setBalance] = useState(0);
|
||||
const intl = useIntl();
|
||||
const dispatch = useDispatch();
|
||||
const fetchInterval = useCallback(() => setInterval(_fetchUserPointActivities, 6 * 60 * 1000), [
|
||||
_fetchUserPointActivities,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isConnected) {
|
||||
_fetchUserPointActivities(username);
|
||||
fetchInterval();
|
||||
}
|
||||
|
||||
if (get(navigation, 'state.params', null)) {
|
||||
@ -64,7 +60,7 @@ const PointsContainer = ({
|
||||
|
||||
setNavigationParams(_navigationParams);
|
||||
}
|
||||
}, [_fetchUserPointActivities, fetchInterval, isConnected, navigation, username]);
|
||||
}, [_fetchUserPointActivities, isConnected, navigation, username]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isConnected && activeBottomTab === ROUTES.TABBAR.WALLET && username) {
|
||||
@ -72,10 +68,6 @@ const PointsContainer = ({
|
||||
}
|
||||
}, [isConnected, username, _fetchUserPointActivities, activeBottomTab]);
|
||||
|
||||
useEffect(() => {
|
||||
return clearInterval(fetchInterval);
|
||||
});
|
||||
|
||||
// Component Functions
|
||||
|
||||
const _handleOnDropdownSelected = index => {
|
||||
@ -137,9 +129,9 @@ const PointsContainer = ({
|
||||
setRefreshing(true);
|
||||
|
||||
await getUser(_username)
|
||||
.then(userPoints => {
|
||||
const _balance = Math.round(get(userPoints, 'points') * 1000) / 1000;
|
||||
setUserPoints(userPoints);
|
||||
.then(userPointsP => {
|
||||
const _balance = Math.round(get(userPointsP, 'points') * 1000) / 1000;
|
||||
setUserPoints(userPointsP);
|
||||
setBalance(_balance);
|
||||
})
|
||||
.catch(err => {
|
||||
@ -147,9 +139,9 @@ const PointsContainer = ({
|
||||
});
|
||||
|
||||
await getUserPoints(_username)
|
||||
.then(userActivities => {
|
||||
if (Object.entries(userActivities).length !== 0) {
|
||||
setUserActivities(_groomUserActivities(userActivities));
|
||||
.then(userActivitiesP => {
|
||||
if (Object.entries(userActivitiesP).length !== 0) {
|
||||
setUserActivities(_groomUserActivities(userActivitiesP));
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
@ -185,7 +177,7 @@ const PointsContainer = ({
|
||||
.catch(error => {
|
||||
if (error) {
|
||||
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,
|
||||
20,
|
||||
)}`,
|
||||
|
Loading…
Reference in New Issue
Block a user