Home Reference Source

application/redux/actions/alert-actions.js

  1. /**
  2. * Action Types
  3. */
  4.  
  5. export const ALERT_SHOW_MESSAGE = 'ALERT_SHOW_MESSAGE';
  6. export const ALERT_CLOSE = 'ALERT_CLOSE';
  7.  
  8. /**
  9. * Action creators
  10. */
  11.  
  12. export function alertShowMessage(options) {
  13. const defaults = {
  14. message: '',
  15. title: 'Warning'
  16. }
  17. let payload = Object.assign({}, defaults, options);
  18.  
  19. return function (dispatch, getState) {
  20. dispatch({
  21. type: ALERT_SHOW_MESSAGE,
  22. payload: payload
  23. });
  24.  
  25. return Promise.resolve();
  26. }
  27. };
  28.  
  29. export function alertClose() {
  30. return function(dispatch, getState) {
  31. dispatch({
  32. type: ALERT_CLOSE,
  33. payload: {}
  34. });
  35. return Promise.resolve();
  36. }
  37. };