dflzm
Version:
x
27 lines (23 loc) • 416 B
JSX
import {
INCREASE,
DECREASE,
} from './constant'
export function increase(n) {
return {
type: INCREASE,
amount: n,
}
}
export function decrease(n) {
return {
type: DECREASE,
amount: n,
}
}
export const async = (n, type) => (dispatch) => {
if (type === 'increase') {
setTimeout(() => dispatch(increase(n)), 1000)
} else {
setTimeout(() => dispatch(decrease(n)), 1000)
}
}