mirror of
https://github.com/microsoft/frontend-bootcamp.git
synced 2026-01-26 14:56:42 +08:00
further cleanup
This commit is contained in:
@@ -8,15 +8,15 @@ function action<T extends string, P>(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<typeof actions[keyof typeof actions]>['type'];
|
||||
export type TodoAction = ReturnType<typeof actions[ActionTypes]>;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user