github.com/muhammedhassanm/blockchain@v0.0.0-20200120143007-697261defd4d/build-blockchain-insurance-app-master/web/src/shop/actions/insuranceActions.js (about) 1 'use strict'; 2 3 import * as InsuranceActionType from './insuranceActionTypes'; 4 import * as Api from '../api'; 5 6 export function loadContractsTypes(shopType) { 7 return async dispatch => { 8 let contractTypes; 9 try { 10 contractTypes = await Api.getContractTypes(shopType); 11 } catch (error) { 12 console.log(error); // Just logging the error nothing more. 13 } 14 if (contractTypes) { 15 dispatch(loadContractsTypesSuccess(contractTypes)); 16 } 17 }; 18 } 19 20 function loadContractsTypesSuccess(contractTypes) { 21 return { 22 type: InsuranceActionType.LOAD_CONTRACT_TYPES_SUCCESS, 23 contractTypes 24 }; 25 } 26 27 export function submitContract(contractInfo) { 28 return { 29 type: InsuranceActionType.SUBMIT_CONTRACT, 30 contractInfo 31 }; 32 }