How to use the electron-redux.createAliasedAction function in electron-redux

To help you get started, we’ve selected a few electron-redux 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 MovieCast / desktop / src / shared / actions / catalog.js View on Github external
type: 'RESET_RESULT'
});

export const setFilter = (payload) => (dispatch) => {
  // Temp fixxzzz
  if (payload.page === 1) {
    dispatch(resetResult());
  }

  dispatch({
    type: SET_FILTER,
    payload
  });
  dispatch(fetchMovies());
};
export const fetchMovies = createAliasedAction(
  FETCH_MOVIES_REQUEST,
  () => ({
    types: [FETCH_MOVIES_REQUEST, FETCH_MOVIES_SUCCESS, FETCH_MOVIES_FAILURE],
    // shouldRequest: state => !state.catalog.entities,
    request: ({ catalog }) => getMovies(catalog.filter),
    parser: ({ data }) => movieNormalizer(data)
  })
);

export const fetchMovie = createAliasedAction(
  FETCH_MOVIE,
  (id) => ({
    type: FETCH_MOVIE,
    payload: getMovie(id),
  })
);
github MovieCast / desktop / src / shared / actions / catalog.js View on Github external
type: SET_FILTER,
    payload
  });
  dispatch(fetchMovies());
};
export const fetchMovies = createAliasedAction(
  FETCH_MOVIES_REQUEST,
  () => ({
    types: [FETCH_MOVIES_REQUEST, FETCH_MOVIES_SUCCESS, FETCH_MOVIES_FAILURE],
    // shouldRequest: state => !state.catalog.entities,
    request: ({ catalog }) => getMovies(catalog.filter),
    parser: ({ data }) => movieNormalizer(data)
  })
);

export const fetchMovie = createAliasedAction(
  FETCH_MOVIE,
  (id) => ({
    type: FETCH_MOVIE,
    payload: getMovie(id),
  })
);
github SelfKeyFoundation / Identity-Wallet / src / common / prices / actions.js View on Github external
import * as types from './types';
import { createAliasedAction } from 'electron-redux';

const updatePrices = createAliasedAction(types.PRICES_UPDATE, prices => ({
	type: types.PRICES_UPDATE,
	payload: prices
}));

export { updatePrices };
github SelfKeyFoundation / Identity-Wallet / src / common / marketplaces / operations.js View on Github external
if (!rp.templates[templateId]) throw new Error('template does not exist');

	const wallet = walletSelectors.getWallet(getState());
	if (!wallet) return;
	const attributes = marketplacesSelectors.selectKYCAttributes(
		getState(),
		wallet.id,
		attributeIds
	);
	const application = await rp.session.createKYCApplication(rpName, templateId, attributes);
	await dispatch(marketplacesActions.addKYCApplication(rpName, application));
};

export const marketplacesOperations = {
	...marketplacesActions,
	loadTransactions: createAliasedAction(
		marketplacesTypes.MARKETPLACE_TRANSACTIONS_LOAD,
		loadTransactionsOperation
	),
	loadStakes: createAliasedAction(marketplacesTypes.MARKETPLACE_STAKES_LOAD, loadStakesOperation),
	placeStake: createAliasedAction(
		marketplacesTypes.MARKETPLACE_STAKES_PLACE,
		placeStakeOperation
	),
	withdrawStake: createAliasedAction(
		marketplacesTypes.MARKETPLACE_STAKES_WITHDRAW,
		withdrawStakeOperation
	),
	updateTransactionStatus: createAliasedAction(
		marketplacesTypes.MARKETPLACE_TRANSACTIONS_UPDATE_STATUS,
		updateTransactionStatusOperation
	),
github SelfKeyFoundation / Identity-Wallet / src / common / marketplaces / index.js View on Github external
tx.gasPrice,
			tx.gasLimit
		)
	);
	await dispatch(marketplacesActions.showMarketplacePopupAction('pendingTransaction'));
	await dispatch(marketplacesActions.clearCurrentTransactionAction());
};

export const cancelCurrentTransactionOperation = () => async (dispatch, getState) => {
	await dispatch(marketplacesActions.clearCurrentTransactionAction());
	await dispatch(marketplacesActions.showMarketplacePopupAction(null));
};

export const marketplacesOperations = {
	...marketplacesActions,
	loadTransactions: createAliasedAction(
		marketplacesTypes.MARKETPLACE_TRANSACTIONS_LOAD,
		loadTransactionsOperation
	),
	loadStakes: createAliasedAction(marketplacesTypes.MARKETPLACE_STAKES_LOAD, loadStakesOperation),
	placeStake: createAliasedAction(
		marketplacesTypes.MARKETPLACE_STAKES_PLACE,
		placeStakeOperation
	),
	withdrawStake: createAliasedAction(
		marketplacesTypes.MARKETPLACE_STAKES_WITHDRAW,
		withdrawStakeOperation
	),
	updateTransactionStatus: createAliasedAction(
		marketplacesTypes.MARKETPLACE_TRANSACTIONS_UPDATE_STATUS,
		updateTransactionStatusOperation
	),
github SelfKeyFoundation / Identity-Wallet / src / common / wallet / actions.js View on Github external
import * as types from './types';
import { createAliasedAction } from 'electron-redux';

const updateWallet = createAliasedAction(types.WALLET_UPDATE, wallet => ({
	type: types.WALLET_UPDATE,
	payload: wallet
}));

const setAssociateError = error => ({
	type: types.WALLET_ASSOCIATE_DID_ERROR_SET,
	payload: error
});

const setDidOriginUrl = didOriginUrl => ({
	type: types.WALLET_DID_ORIGIN_URL_SET,
	payload: didOriginUrl
});

export { updateWallet, setAssociateError, setDidOriginUrl };
github SelfKeyFoundation / Identity-Wallet / src / common / transaction-history / index.js View on Github external
const txHistoryService = getGlobalContext().txHistoryService;
	await dispatch(transactionHistoryActions.setProcessingAction(true));
	await txHistoryService.reload(wallet);
	await dispatch(transactionHistoryActions.setProcessingAction(false));
	const transactions = await txHistoryService.getTransactions(wallet.address);
	await dispatch(transactionHistoryActions.setTransactionsAction(transactions));
};

const operations = {
	loadTransactions,
	reloadTransactions
};

const transactionHistoryOperations = {
	...transactionHistoryActions,
	loadTransactionsOperation: createAliasedAction(
		transactionHistoryTypes.TRANSACTION_HISTORY_LOAD_TRANSACTIONS,
		operations.loadTransactions
	),
	reloadTransactionsOperation: createAliasedAction(
		transactionHistoryTypes.TRANSACTION_HISTORY_RELOAD_TRANSACTIONS,
		operations.reloadTransactions
	)
};

const setTransactionsReducer = (state, action) => {
	return { ...state, transactions: action.payload };
};

const setProcessingReducer = (state, action) => {
	return { ...state, processing: action.payload };
};
github MovieCast / desktop / src / shared / actions / entities.js View on Github external
import { normalize } from 'normalizr';
import { createAliasedAction } from 'electron-redux';
import MovieProvider from '../providers/MovieProvider';
import * as movieSchema from '../normalizers/movie';

export const FETCH_MOVIES_REQUEST = 'FETCH_MOVIES_REQUEST';
export const FETCH_MOVIES_SUCCESS = 'FETCH_MOVIES_SUCCESS';
export const FETCH_MOVIES_FAILURE = 'FETCH_MOVIES_FAILURE';

export const FETCH_MOVIE_REQUEST = 'FETCH_MOVIE_REQUEST';
export const FETCH_MOVIE_SUCCESS = 'FETCH_MOVIE_SUCCESS';
export const FETCH_MOVIE_FAILURE = 'FETCH_MOVIE_FAILURE';

export const fetchMovies = createAliasedAction(
  FETCH_MOVIES_REQUEST,
  () => ({
    types: [FETCH_MOVIES_REQUEST, FETCH_MOVIES_SUCCESS, FETCH_MOVIES_FAILURE],
    request: ({ catalog }) => MovieProvider.getMovies(catalog.filter),
    parser: ({ data }) => normalize(data.results, movieSchema.movieList)
  })
);

export const fetchMovie = createAliasedAction(
  FETCH_MOVIE_REQUEST,
  (id) => ({
    types: [FETCH_MOVIE_REQUEST, FETCH_MOVIE_SUCCESS, FETCH_MOVIE_FAILURE],
    request: () => MovieProvider.getMovie(id),
    parser: ({ data }) => normalize(data, movieSchema.movie)
  })
);
github SelfKeyFoundation / Identity-Wallet / src / common / app / index.js View on Github external
appTypes.APP_SET_TERMS_ACCEPTED,
		operations.setTermsAccepted
	),
	networkStatusUpdateOperation: createAliasedAction(
		appTypes.APP_SET_NETWORK_STATUS,
		operations.networkStatusUpdateOperation
	),
	startAutoUpdateOperation: createAliasedAction(
		appTypes.APP_START_AUTO_UPDATE,
		operations.startAutoUpdate
	),
	downloadUpdateOperation: createAliasedAction(
		appTypes.APP_DOWNLOAD_UPDATE,
		operations.downloadUpdate
	),
	installUpdateOperation: createAliasedAction(
		appTypes.APP_INSTALL_UPDATE,
		operations.installUpdate
	)
};

const setWalletsReducer = (state, action) => {
	return { ...state, wallets: action.payload };
};

const setWalletsLoadingReducer = (state, action) => {
	return { ...state, walletsLoading: action.payload };
};

const setHardwareWalletsReducer = (state, action) => {
	return { ...state, hardwareWallets: action.payload };
};
github SelfKeyFoundation / Identity-Wallet / src / common / tokens / operations.js View on Github external
const loadTokens = () => async (dispatch, getState) => {
	const tokenService = getGlobalContext().tokenService;
	const tokens = await tokenService.loadTokens();
	dispatch(actions.setTokens(tokens));
};

const addToken = contractAddress => async dispatch => {
	const tokenService = getGlobalContext().tokenService;
	const tokenInfo = await tokenService.getTokenInfo(contractAddress);
	await tokenService.addToken(tokenInfo);
	dispatch(loadTokens());
};

export default {
	...actions,
	loadTokensOperation: createAliasedAction(types.TOKENS_LOAD, loadTokens),
	addTokenOperation: createAliasedAction(types.TOKENS_ADD, addToken)
};

electron-redux

Redux & Electron: Make sure all your stores are on the same page

MIT
Latest version published 2 months ago

Package Health Score

84 / 100
Full package analysis

Popular electron-redux functions

Similar packages