Skip to content

Instantly share code, notes, and snippets.

@victorvhpg
Last active April 9, 2018 02:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save victorvhpg/d286ed3425a3e8e635ac0cd32a6c16ba to your computer and use it in GitHub Desktop.
Save victorvhpg/d286ed3425a3e8e635ac0cd32a6c16ba to your computer and use it in GitHub Desktop.
actions.js
import CONSTANTS from '../constants';
export let actionCreditar = (valorCredito) => {
return {
type: CONSTANTS.CREDITO,
payload: {
valor: valorCredito
}
};
};
export let actionDebitar = (valorDebito) => {
return {
type: CONSTANTS.DEBITO,
payload: {
valor: valorDebito
}
};
};
export let setValorTransacao = (v) => {
return {
type: CONSTANTS.SET_VALOR_TRANSACAO,
payload: {
valorTransacao: v
}
};
};
export let actionErro = (descricaoErro) => {
return {
type: CONSTANTS.ERRO_CONTA,
error: true,
payload: new Error(descricaoErro)
};
};
export let actionCreditarAsync = (valorCredito) => {
return (dispatch) => {
window.setTimeout(() => {
dispatch(actionCreditar(valorCredito));
}, 3000);
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment