API helpers: split the function creating journal entry.

master
Tom Hacohen 6 years ago
parent 941b47b59a
commit cd28f282fb

@ -3,7 +3,7 @@ import * as EteSync from './api/EteSync';
import { CredentialsData, UserInfoData } from './store'; import { CredentialsData, UserInfoData } from './store';
import { addEntries } from './store/actions'; import { addEntries } from './store/actions';
export function addJournalEntry( export function createJournalEntry(
etesync: CredentialsData, etesync: CredentialsData,
userInfo: UserInfoData, userInfo: UserInfoData,
journal: EteSync.Journal, journal: EteSync.Journal,
@ -30,5 +30,17 @@ export function addJournalEntry(
const entry = new EteSync.Entry(); const entry = new EteSync.Entry();
entry.setSyncEntry(cryptoManager, syncEntry, prevUid); entry.setSyncEntry(cryptoManager, syncEntry, prevUid);
return entry;
}
export function addJournalEntry(
etesync: CredentialsData,
userInfo: UserInfoData,
journal: EteSync.Journal,
prevUid: string | null,
action: EteSync.SyncEntryAction,
content: string) {
const entry = createJournalEntry(etesync, userInfo, journal, prevUid, action, content);
return addEntries(etesync, journal.uid, [entry], prevUid); return addEntries(etesync, journal.uid, [entry], prevUid);
} }

Loading…
Cancel
Save