From 1e1033fdf124b2e6bc7dbf598ef946de30573977 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Mon, 13 Aug 2018 10:28:33 +0100 Subject: [PATCH] Actions fetchAll: return a promise rather than undefined. --- src/store/actions.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/store/actions.ts b/src/store/actions.ts index 096746a..f358c08 100644 --- a/src/store/actions.ts +++ b/src/store/actions.ts @@ -107,10 +107,10 @@ export const createUserInfo = createAction( export function fetchAll(etesync: CredentialsData, currentEntries: EntriesType) { return (dispatch: any) => { - dispatch(fetchJournals(etesync)).then((journalsAction: any) => { + return dispatch(fetchJournals(etesync)).then((journalsAction: any) => { const journals: Array = journalsAction.payload; - if (!journals) { - return; + if (!journals || (journals.length === 0)) { + return false; } journals.forEach((journal) => { @@ -123,6 +123,8 @@ export function fetchAll(etesync: CredentialsData, currentEntries: EntriesType) dispatch(fetchEntries(etesync, journal.uid, prevUid)); }); + + return true; }); }; }