From 9b7f24eb8a2d4e2222d5c0be920b859d96967164 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Fri, 15 Mar 2019 18:41:29 +0000 Subject: [PATCH] Store actions: Rename createEntries -> addEntries. --- src/etesync-helpers.ts | 4 ++-- src/store/actions.ts | 4 ++-- src/store/index.test.ts | 4 ++-- src/store/reducers.ts | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/etesync-helpers.ts b/src/etesync-helpers.ts index 8b3ecf8..e2ea8fd 100644 --- a/src/etesync-helpers.ts +++ b/src/etesync-helpers.ts @@ -1,7 +1,7 @@ import * as EteSync from './api/EteSync'; import { CredentialsData, UserInfoData } from './store'; -import { createEntries } from './store/actions'; +import { addEntries } from './store/actions'; export function createJournalEntry( etesync: CredentialsData, @@ -30,5 +30,5 @@ export function createJournalEntry( const entry = new EteSync.Entry(); entry.setSyncEntry(cryptoManager, syncEntry, prevUid); - return createEntries(etesync, journal.uid, [entry], prevUid); + return addEntries(etesync, journal.uid, [entry], prevUid); } diff --git a/src/store/actions.ts b/src/store/actions.ts index 6dedefa..327c125 100644 --- a/src/store/actions.ts +++ b/src/store/actions.ts @@ -96,7 +96,7 @@ export const deleteJournal = createAction( } ); -export const { fetchEntries, createEntries } = createActions({ +export const { fetchEntries, addEntries } = createActions({ FETCH_ENTRIES: [ (etesync: CredentialsData, journalUid: string, prevUid: string | null) => { const creds = etesync.credentials; @@ -109,7 +109,7 @@ export const { fetchEntries, createEntries } = createActions({ return { journal: journalUid, prevUid }; }, ], - CREATE_ENTRIES: [ + ADD_ENTRIES: [ (etesync: CredentialsData, journalUid: string, newEntries: EteSync.Entry[], prevUid: string | null) => { const creds = etesync.credentials; const apiBase = etesync.serviceApiUrl; diff --git a/src/store/index.test.ts b/src/store/index.test.ts index a55a3f5..49ead34 100644 --- a/src/store/index.test.ts +++ b/src/store/index.test.ts @@ -1,4 +1,4 @@ -import { createEntries, fetchEntries } from './actions'; +import { addEntries, fetchEntries } from './actions'; import { entries, EntriesTypeImmutable } from './reducers'; import { Map } from 'immutable'; @@ -43,7 +43,7 @@ it('Entries reducer', () => { expect(journal.value.size).toBe(2); // Creating entries should also work the same - action.type = createEntries.toString(); + action.type = addEntries.toString(); state = entries(state, action as any); journal = state.get(jId) as any; expect(journal.value.size).toBe(3); diff --git a/src/store/reducers.ts b/src/store/reducers.ts index 798f3f1..9957883 100644 --- a/src/store/reducers.ts +++ b/src/store/reducers.ts @@ -203,7 +203,7 @@ function fetchCreateEntriesReducer(state: EntriesTypeImmutable, action: any) { export const entries = handleActions( { [actions.fetchEntries.toString()]: fetchCreateEntriesReducer, - [actions.createEntries.toString()]: fetchCreateEntriesReducer, + [actions.addEntries.toString()]: fetchCreateEntriesReducer, [actions.addJournal.toString()]: (state: EntriesTypeImmutable, action: any) => { const journal = action.meta.item.uid; const prevState = state.get(journal);