Store actions: Rename createEntries -> addEntries.

master
Tom Hacohen 6 years ago
parent 49273fbc6f
commit 9b7f24eb8a

@ -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);
}

@ -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;

@ -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);

@ -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);

Loading…
Cancel
Save