Last active
April 9, 2018 02:14
-
-
Save victorvhpg/d286ed3425a3e8e635ac0cd32a6c16ba to your computer and use it in GitHub Desktop.
actions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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