Store objects to IndexedDB (#6826)

This commit is contained in:
Akihiko Odaki 2018-03-24 21:06:27 +09:00 committed by Eugen Rochko
parent 28384c1771
commit fe398a098e
20 changed files with 433 additions and 355 deletions

View file

@ -1,3 +1,4 @@
import { importFetchedStatus, importFetchedStatuses } from './importer';
import api, { getLinks } from '../api';
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
@ -44,6 +45,8 @@ export function updateTimeline(timeline, status) {
}
}
dispatch(importFetchedStatus(status));
dispatch({
type: TIMELINE_UPDATE,
timeline,
@ -109,6 +112,7 @@ export function refreshTimeline(timelineId, path, params = {}) {
dispatch(refreshTimelineSuccess(timelineId, [], skipLoading, null, true));
} else {
const next = getLinks(response).refs.find(link => link.rel === 'next');
dispatch(importFetchedStatuses(response.data));
dispatch(refreshTimelineSuccess(timelineId, response.data, skipLoading, next ? next.uri : null, false));
}
}).catch(error => {
@ -152,6 +156,7 @@ export function expandTimeline(timelineId, path, params = {}) {
api(getState).get(path, { params }).then(response => {
const next = getLinks(response).refs.find(link => link.rel === 'next');
dispatch(importFetchedStatuses(response.data));
dispatch(expandTimelineSuccess(timelineId, response.data, next ? next.uri : null));
}).catch(error => {
dispatch(expandTimelineFail(timelineId, error));