diff --git a/playground/src/actions/index.ts b/playground/src/actions/index.ts index d158d2d..8d5da81 100644 --- a/playground/src/actions/index.ts +++ b/playground/src/actions/index.ts @@ -8,15 +8,15 @@ function action(type: T, payload?: P) { return { type, ...payload }; } -export const add = (label: string) => action('add', { label }); -export const remove = (id: string) => ({ type: 'remove' as 'remove', id }); -export const edit = (id: string, label: string) => ({ type: 'edit' as 'edit', id, label }); -export const complete = (id: string) => ({ type: 'complete' as 'complete', id }); -export const completeAll = () => ({ type: 'completeAll' as 'completeAll' }); -export const clear = () => ({ type: 'clear' as 'clear' }); -export const filter = (filterTypes: string) => ({ type: 'filter' as 'filter', filter: filterTypes }); - -export const actions = { add, remove, edit, complete, completeAll, clear, filter }; +export const actions = { + add: (label: string) => action('add', { label }), + remove: (id: string) => action('remove', { id }), + edit: (id: string, label: string) => action('edit', { id, label }), + complete: (id: string) => action('complete', { id }), + completeAll: () => action('completeAll'), + clear: () => action('clear'), + filter: (filterTypes: string) => action('filter', { filter: filterTypes }) +}; export type ActionTypes = ReturnType['type']; export type TodoAction = ReturnType; diff --git a/playground/src/components/TodoHeader.tsx b/playground/src/components/TodoHeader.tsx index 22713a8..5468871 100644 --- a/playground/src/components/TodoHeader.tsx +++ b/playground/src/components/TodoHeader.tsx @@ -1,7 +1,6 @@ import React from 'react'; import { Text, Stack } from '@uifabric/experiments'; import { Pivot, PivotItem, TextField } from 'office-ui-fabric-react'; -import { add } from '../actions'; import { FilterTypes } from '../store'; export interface TodoHeaderProps { diff --git a/playground/src/reducers/index.ts b/playground/src/reducers/index.ts index 880cbaf..0af3bd7 100644 --- a/playground/src/reducers/index.ts +++ b/playground/src/reducers/index.ts @@ -1,8 +1,6 @@ import { createReducer } from './createReducer'; import { Store, FilterTypes } from '../store'; import { combineReducers } from 'redux'; -import produce from 'immer'; -import { edit } from '../actions'; let counter = 0;