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.
master
Tom Hacohen 5 years ago
parent 46fe1ceeb6
commit a557ec1fd2

@ -1,9 +1,9 @@
import { createAction, createActions } from 'redux-actions'; import { Action, createAction, createActions } from 'redux-actions';
import * as EteSync from '../api/EteSync'; import * as EteSync from '../api/EteSync';
import { UserInfo } from '../api/EteSync'; import { UserInfo } from '../api/EteSync';
import { CredentialsData, EntriesType, JournalsData, SettingsType } from './'; import { CredentialsData, EntriesType, SettingsType } from './';
export const { fetchCredentials, logout } = createActions({ export const { fetchCredentials, logout } = createActions({
FETCH_CREDENTIALS: (username: string, password: string, server: string) => { 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) { export function fetchAll(etesync: CredentialsData, currentEntries: EntriesType) {
return (dispatch: any) => { return (dispatch: any) => {
return dispatch(fetchListJournal(etesync)).then((journalsAction: any) => { return dispatch(fetchListJournal(etesync)).then((journalsAction: Action<EteSync.Journal[]>) => {
const journals: JournalsData = journalsAction.payload; const journals = journalsAction.payload;
if (!journals || journals.isEmpty) { if (!journals || (journals.length === 0)) {
return false; return false;
} }
journals.forEach((journal, uid) => { journals.forEach((journal) => {
dispatch(fetchJournalEntries(etesync, currentEntries, journal)); dispatch(fetchJournalEntries(etesync, currentEntries, journal));
}); });

Loading…
Cancel
Save