"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ajax_1 = require("rxjs/ajax");
var operators_1 = require("rxjs/operators");
var rx_redux_1 = require("../rx-redux");
exports.baseActions = {
    loadConfig: rx_redux_1.actionCreator(function (payload) {
        if (typeof payload === 'string') {
            return {
                type: 'CONFIG_LOADING',
                payload: ajax_1.ajax(payload).pipe(operators_1.map(function (xhr) {
                    return {
                        type: 'CONFIG_LOADED',
                        payload: xhr.response
                    };
                }))
            };
        }
        else {
            return {
                type: 'CONFIG_LOADED',
                payload: payload
            };
        }
    }),
    addConfig: rx_redux_1.actionCreator(function (payload) {
        return {
            type: 'ADD_CONFIG',
            payload: payload
        };
    }),
    setConfig: rx_redux_1.actionCreator(function (key, value) {
        var payload = {};
        payload[key] = value;
        return {
            type: 'ADD_CONFIG',
            payload: payload
        };
    }),
};
//# sourceMappingURL=base-actions.js.map