From cd28f282fb9ed8fbe6b4069aaa40fee0c5ee8307 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Fri, 15 Mar 2019 18:45:34 +0000 Subject: [PATCH] API helpers: split the function creating journal entry. --- src/etesync-helpers.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/etesync-helpers.ts b/src/etesync-helpers.ts index 32abbf5..0e35f0c 100644 --- a/src/etesync-helpers.ts +++ b/src/etesync-helpers.ts @@ -3,7 +3,7 @@ import * as EteSync from './api/EteSync'; import { CredentialsData, UserInfoData } from './store'; import { addEntries } from './store/actions'; -export function addJournalEntry( +export function createJournalEntry( etesync: CredentialsData, userInfo: UserInfoData, journal: EteSync.Journal, @@ -30,5 +30,17 @@ export function addJournalEntry( const entry = new EteSync.Entry(); 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); }