mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-14 10:35:11 +00:00
remove use of thunk action in ble and hub
This is a step towards moving these to sagas
This commit is contained in:
committed by
David Lechner
parent
99fd62100d
commit
24acab901c
@@ -2,17 +2,14 @@
|
||||
// Copyright (c) 2020 The Pybricks Authors
|
||||
|
||||
import { connect } from 'react-redux';
|
||||
import { AnyAction } from 'redux';
|
||||
import { ThunkDispatch } from 'redux-thunk';
|
||||
import { Action, Dispatch } from '../actions';
|
||||
import { stop } from '../actions/hub';
|
||||
import { RootState } from '../reducers';
|
||||
import { HubRuntimeState } from '../reducers/hub';
|
||||
import ActionButton, { ActionButtonProps } from './ActionButton';
|
||||
import stopIcon from './images/stop.svg';
|
||||
|
||||
type Dispatch = ThunkDispatch<{}, {}, AnyAction>;
|
||||
|
||||
type StateProps = Pick<ActionButtonProps, 'enabled' | 'context'>;
|
||||
type StateProps = Pick<ActionButtonProps, 'enabled'>;
|
||||
type DispatchProps = Pick<ActionButtonProps, 'onAction'>;
|
||||
type OwnProps = Pick<ActionButtonProps, 'id'>;
|
||||
|
||||
@@ -21,9 +18,7 @@ const mapStateToProps = (state: RootState): StateProps => ({
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => ({
|
||||
onAction: (): void => {
|
||||
dispatch(stop());
|
||||
},
|
||||
onAction: (): Action => dispatch(stop()),
|
||||
});
|
||||
|
||||
const mergeProps = (
|
||||
|
||||
Reference in New Issue
Block a user