2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 import {actionTypes} from './SoftwareProductNetworksConstants.js';
22 import RestAPIUtil from 'nfvo-utils/RestAPIUtil.js';
23 import Configuration from 'sdc-app/config/Configuration.js';
25 function baseUrl(svpId) {
26 const restPrefix = Configuration.get('restPrefix');
27 return `${restPrefix}/v1.0/vendor-software-products/${svpId}/networks`;
31 function fetchNetworksList(softwareProductId, version) {
32 let versionQuery = version ? `?version=${version}` : '';
33 return RestAPIUtil.fetch(`${baseUrl(softwareProductId)}${versionQuery}`);
36 const SoftwareProductNetworksActionHelper = {
37 fetchNetworksList(dispatch, {softwareProductId, version}) {
38 return fetchNetworksList(softwareProductId, version).then(response => {
40 type: actionTypes.FETCH_SOFTWARE_PRODUCT_NETWORKS,
41 networksList: response.results
47 export default SoftwareProductNetworksActionHelper;