/*!
 * Copyright © 2016-2018 European Support Limited
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
import RestAPIUtil from 'nfvo-utils/RestAPIUtil.js';
import Configuration from 'sdc-app/config/Configuration.js';
import { actionTypes } from './FeaturesConstants.js';

function baseUrl() {
    const restPrefix = Configuration.get('restPrefix');
    return `${restPrefix}/v1.0/togglz`;
}

function fetchList() {
    return RestAPIUtil.fetch(baseUrl());
}

export default {
    getFeaturesList(dispatch) {
        return fetchList()
            .then(response => {
                dispatch({
                    type: actionTypes.FEATURES_LIST_LOADED,
                    features: response.features
                });
            })
            .catch(() =>
                console.error(
                    'An exception occured while trying to fetch the toggleZ features.'
                )
            );
    }
};
