diff --git a/lib/actions/draft-actions.js b/lib/actions/draft-actions.js new file mode 100644 index 000000000..e67558d21 --- /dev/null +++ b/lib/actions/draft-actions.js @@ -0,0 +1,7 @@ +// @flow + +const updateDraftActionType = 'UPDATE_DRAFT'; +const moveDraftActionType = 'MOVE_DRAFT'; +const setDraftStoreDrafts = 'SET_DRAFT_STORE_DRAFTS'; + +export { updateDraftActionType, moveDraftActionType, setDraftStoreDrafts }; diff --git a/lib/types/draft-types.js b/lib/types/draft-types.js new file mode 100644 index 000000000..d4ee59fca --- /dev/null +++ b/lib/types/draft-types.js @@ -0,0 +1,25 @@ +// @flow + +export type DraftStore = { + +drafts: { +[key: string]: string }, +}; + +export type UpdateDraftOperation = { + +type: 'update', + +payload: { +key: string, +text: string }, +}; + +export type MoveDraftOperation = { + +type: 'move', + +payload: { +oldKey: string, +newKey: string }, +}; + +export type RemoveAllDraftsOperation = { + +type: 'remove_all', +}; + +export type DraftStoreOperation = + | UpdateDraftOperation + | MoveDraftOperation + | RemoveAllDraftsOperation; +export type ClientDBDraftStoreOperation = DraftStoreOperation;