Home Reference Source

application/redux/actions/alert-actions.js

/**
 * Action Types
 */

export const ALERT_SHOW_MESSAGE = 'ALERT_SHOW_MESSAGE';
export const ALERT_CLOSE = 'ALERT_CLOSE';

/**
 * Action creators
 */

export function alertShowMessage(options) {
    const defaults = {
        message: '',
        title: 'Warning'
    }
    let payload = Object.assign({}, defaults, options);

    return function (dispatch, getState) {
        dispatch({
            type: ALERT_SHOW_MESSAGE,
            payload: payload
        });

        return Promise.resolve();
    }
};

export function alertClose() {
    return function(dispatch, getState) {
        dispatch({
            type: ALERT_CLOSE,
            payload: {}
        });
        return Promise.resolve();
    }
};