import { ajax } from 'rxjs/ajax';
import { map } from 'rxjs/operators';
import { actionCreator } from '../rx/rx-redux';
export const baseActions = {
    loadConfig: actionCreator((payload) => {
        if (typeof payload === 'string') {
            return {
                type: 'CONFIG_LOADING',
                payload: ajax(payload).pipe(map((xhr) => {
                    return {
                        type: 'CONFIG_LOADED',
                        payload: xhr.response
                    };
                }))
            };
        }
        else {
            return {
                type: 'CONFIG_LOADED',
                payload: payload
            };
        }
    }),
    setConfig: actionCreator((payload) => {
        return {
            type: 'SET_CONFIG',
            payload: payload
            // payload: {key: payload.key, value: payload.value}
        };
    }),
};
//# sourceMappingURL=base-actions.js.map