Merge "Data Dictionary has erroneous resolution source for vnf-name."
[ccsdk/cds.git] / cds-ui / client / src / app / common / core / store / reducers / catalog.reducer.ts
1 /*
2 * ============LICENSE_START=======================================================
3 * ONAP : CDS
4 * ================================================================================
5 * Copyright (C) 2019 TechMahindra
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
10 *
11 *     http://www.apache.org/licenses/LICENSE-2.0
12 *
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=========================================================
19 */
20
21 import { Action } from '@ngrx/store';
22 import { initialCatalogState } from '../state/catalog.state';
23 import * as CatalogActions from '../actions/catalog.action';
24 import { ICatalogState } from '../models/catalogState.model';
25
26 export function catalogReducer(state: ICatalogState = initialCatalogState, action: CatalogActions.Actions) : ICatalogState {
27     switch(action.type) {
28         case CatalogActions.LOAD_CATALOG_SUCCESS:
29             return {...state,
30                     catalog: action.payload
31                     }
32         case CatalogActions.SET_CATALOG_STATE:
33             return {...state,
34                     catalog: action.payload.catalog
35                     }
36         default:
37             return state;
38     }
39 }