Actions fetchAll: return a promise rather than undefined.

master
Tom Hacohen 6 years ago
parent 8e7243964d
commit 1e1033fdf1

@ -107,10 +107,10 @@ export const createUserInfo = createAction(
export function fetchAll(etesync: CredentialsData, currentEntries: EntriesType) { export function fetchAll(etesync: CredentialsData, currentEntries: EntriesType) {
return (dispatch: any) => { return (dispatch: any) => {
dispatch(fetchJournals(etesync)).then((journalsAction: any) => { return dispatch(fetchJournals(etesync)).then((journalsAction: any) => {
const journals: Array<EteSync.Journal> = journalsAction.payload; const journals: Array<EteSync.Journal> = journalsAction.payload;
if (!journals) { if (!journals || (journals.length === 0)) {
return; return false;
} }
journals.forEach((journal) => { journals.forEach((journal) => {
@ -123,6 +123,8 @@ export function fetchAll(etesync: CredentialsData, currentEntries: EntriesType)
dispatch(fetchEntries(etesync, journal.uid, prevUid)); dispatch(fetchEntries(etesync, journal.uid, prevUid));
}); });
return true;
}); });
}; };
} }

Loading…
Cancel
Save