From a557ec1fd26b9422c6548872e9c144362a297fb6 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Mon, 27 May 2019 20:12:24 +0100 Subject: [PATCH] Fix creation of default journals for new accounts. I don't know when it stopped working or why, but this fixes it. It was obviously an error, and was caused by sloppy typing. --- src/store/actions.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/store/actions.ts b/src/store/actions.ts index 4a54087..c18faf6 100644 --- a/src/store/actions.ts +++ b/src/store/actions.ts @@ -1,9 +1,9 @@ -import { createAction, createActions } from 'redux-actions'; +import { Action, createAction, createActions } from 'redux-actions'; import * as EteSync from '../api/EteSync'; import { UserInfo } from '../api/EteSync'; -import { CredentialsData, EntriesType, JournalsData, SettingsType } from './'; +import { CredentialsData, EntriesType, SettingsType } from './'; export const { fetchCredentials, logout } = createActions({ FETCH_CREDENTIALS: (username: string, password: string, server: string) => { @@ -170,13 +170,13 @@ export function fetchJournalEntries(etesync: CredentialsData, currentEntries: En export function fetchAll(etesync: CredentialsData, currentEntries: EntriesType) { return (dispatch: any) => { - return dispatch(fetchListJournal(etesync)).then((journalsAction: any) => { - const journals: JournalsData = journalsAction.payload; - if (!journals || journals.isEmpty) { + return dispatch(fetchListJournal(etesync)).then((journalsAction: Action) => { + const journals = journalsAction.payload; + if (!journals || (journals.length === 0)) { return false; } - journals.forEach((journal, uid) => { + journals.forEach((journal) => { dispatch(fetchJournalEntries(etesync, currentEntries, journal)); });