How to use the spunky.withActions function in spunky

To help you get started, we’ve selected a few spunky examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nos / client / src / login / components / LoginFormLedger / index.js View on Github external
const mapLedgerActionsToProps = (actions) => ({
  poll: () => actions.call()
});

const mapLedgerDataToProps = (data) => {
  const { deviceInfo, publicKey } = data || {};
  return { deviceInfo, publicKey };
};

const mapLedgerErrorToProps = (error) => ({
  deviceError: error
});

export default compose(
  withActions(ledgerActions, mapLedgerActionsToProps),
  withData(ledgerActions, mapLedgerDataToProps),
  withError(ledgerActions, mapLedgerErrorToProps),

  // redirect on login
  withRouter,
  withLogin((state, { history }) => history.push('/browser'))
)(LoginFormLedger);
github nos / client / src / renderer / browser / hocs / withClean.js View on Github external
return (Component) => {
    class WithCleanComponent extends React.PureComponent {
      componentWillUnmount() {
        this.props[propName]();
      }

      render() {
        return ;
      }
    }

    return withActions(actions, mapActionsToProps)(WithCleanComponent);
  };
}
github CityOfZion / neon-wallet / app / hocs / withProgressPanel.js View on Github external
export default function withProgressPanel(
  actions,
  { title, strategy = recentlyCompletedStrategy, ...options } = {},
) {
  const Loading = withProps({ title })(LoadingPanel)
  const Failed = withProps(props => ({ title, onRetry: props.onRetry }))(
    FailedPanel,
  )

  return compose(
    withActions(actions, mapActionsToProps),
    withProgressComponents(
      actions,
      {
        [LOADING]: Loading,
        [FAILED]: Failed,
      },
      {
        strategy,
        ...options,
      },
    ),
  )
}
github nos / client / src / renderer / register / components / AccountDetails / SaveAccount / index.js View on Github external
const mapStoreProfileActionsToProps = (actions) => ({
  storeProfile: ({ walletName, address, encryptedKey }) => {
    return actions.call({ walletName, address, encryptedKey });
  }
});

const mapAuthActionsToProps = (actions) => ({
  login: ({ wif, passphrase, encryptedWIF, publicKey }) => {
    return actions.call({ wif, passphrase, encryptedWIF, publicKey });
  }
});

export default compose(
  withAlert(),
  withActions(writePreviousAuthActions, mapPreviousAuthActionsToProps),
  withActions(storeProfileActions, mapStoreProfileActionsToProps),
  withActions(authActions, mapAuthActionsToProps),
  withProgress(authActions, { strategy: pureStrategy }),
  withProps((props) => ({ loading: props.progress === LOADING }))
)(SaveAccount);
github nos / client / src / components / AuthenticatedLayout / AddressBar / index.js View on Github external
import { withActions, withData } from 'spunky';

import AddressBar from './AddressBar';
import nameServiceActions from '../../../actions/nameServiceActions';

const mapNameServiceActionsToProps = (actions) => ({
  doQuery: (params) => actions.call(params)
});

const mapNameServiceDataToProps = (data) => ({
  query: data && data.query,
  target: data && data.target
});

export default compose(
  withActions(nameServiceActions, mapNameServiceActionsToProps),
  withData(nameServiceActions, mapNameServiceDataToProps),
  withRouter
)(AddressBar);
github nos / client / src / components / Login / index.js View on Github external
import { compose } from 'recompose';
import { withActions } from 'spunky';

import Login from './Login';
import authActions from '../../actions/authActions';
import withAuthError from '../../hocs/withAuthError';

const mapAuthActionsToProps = (actions) => ({
  login: ({ wif, passphrase, encryptedWIF, publicKey }) => {
    return actions.call({ wif, passphrase, encryptedWIF, publicKey });
  }
});

export default compose(
  withActions(authActions, mapAuthActionsToProps),
  withAuthError
)(Login);
github nos / client / src / renderer / shared / components / NewWallet / Import / ExistingImport / index.js View on Github external
import { progressValues, withActions } from 'spunky';

import { withErrorToast } from 'shared/hocs/withToast';
import withProgressChange from 'shared/hocs/withProgressChange';
import { importWalletActions } from 'auth/actions/walletActions';

import ExistingImport from './ExistingImport';

const { FAILED, LOADED } = progressValues;

const mapAddAccountActionsToProps = (actions) => ({
  addAccount: (data) => actions.call(data)
});

export default compose(
  withActions(importWalletActions, mapAddAccountActionsToProps),

  withState('currentAccount', 'setCurrentAccount', ({ accounts }) => {
    return accounts[0] && accounts[0].encryptedKey;
  }),
  withState('legacyPassphrase', 'setLegacyPassphrase', ''),
  withState('passphrase', 'setPassphrase', ''),

  withErrorToast(),
  withProgressChange(importWalletActions, FAILED, (state, props) => {
    props.showErrorToast(state.error);
  }),
  withProgressChange(importWalletActions, LOADED, (state, props) => {
    props.onConfirm();
  })
)(ExistingImport);

spunky

Lifecycle management for react-redux

MIT
Latest version published 7 years ago

Package Health Score

36 / 100
Full package analysis