TESTING - Notification logs - 1

TESTING - Notification logs - 1
This commit is contained in:
mgabdev 2020-05-22 02:33:52 -04:00
parent 46b1206be1
commit c280c102b6
1 changed files with 21 additions and 0 deletions

View File

@ -147,17 +147,23 @@ export function expandNotifications({ maxId } = {}, done = noOp) {
return (dispatch, getState) => {
if (!me) return
console.log("-1-expandNotifications:", maxId, done)
const onlyVerified = getState().getIn(['notifications', 'filter', 'onlyVerified'])
const onlyFollowing = getState().getIn(['notifications', 'filter', 'onlyFollowing'])
const activeFilter = getState().getIn(['notifications', 'filter', 'active'])
const notifications = getState().get('notifications')
const isLoadingMore = !!maxId
console.log("-2-expandNotifications:", isLoadingMore)
if (notifications.get('isLoading')) {
done();
return;
}
console.log("-3-expandNotifications")
const params = {
max_id: maxId,
exclude_types: activeFilter === 'all' ? null : excludeTypesFromFilter(activeFilter),
@ -170,18 +176,32 @@ export function expandNotifications({ maxId } = {}, done = noOp) {
params.since_id = notifications.getIn(['items', 0, 'id']);
}
console.log("-4-expandNotifications:", params)
dispatch(expandNotificationsRequest(isLoadingMore));
api(getState).get('/api/v1/notifications', { params }).then(response => {
console.log("-5-(res)-expandNotifications:", response)
const next = getLinks(response).refs.find(link => link.rel === 'next');
console.log("-6-(res)-expandNotifications")
dispatch(importFetchedAccounts(response.data.map(item => item.account)));
dispatch(importFetchedStatuses(response.data.map(item => item.status).filter(status => !!status)));
console.log("-7-(res)-expandNotifications")
dispatch(expandNotificationsSuccess(response.data, next ? next.uri : null, isLoadingMore));
console.log("-8-(res)-expandNotifications")
fetchRelatedRelationships(dispatch, response.data);
console.log("-9-(res)-expandNotifications")
done();
}).catch(error => {
console.log("-10-(error)-expandNotifications:", error, isLoadingMore)
dispatch(expandNotificationsFail(error, isLoadingMore));
done();
});
@ -196,6 +216,7 @@ export function expandNotificationsRequest(isLoadingMore) {
};
export function expandNotificationsSuccess(notifications, next, isLoadingMore) {
console.log("-11-expandNotificationsSuccess:", notifications, next, isLoadingMore)
return {
type: NOTIFICATIONS_EXPAND_SUCCESS,
notifications,