@shopgate/pwa-common
Version:
Common library for the Shopgate Connect PWA.
6 lines • 1.03 kB
JavaScript
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import{RECEIVE_CLIENT_CONNECTIVITY}from"../../constants/ActionTypes";import{CONNECTIVITY_NETWORK_UNKNOWN,CONNECTIVITY_TYPE_UNKNOWN}from"../../constants/client";var defaultState={connected:true,network:CONNECTIVITY_NETWORK_UNKNOWN,type:CONNECTIVITY_TYPE_UNKNOWN};/**
* Stores the client connectivity data.
* @param {Object} [state] The current state.
* @param {Object} action The action object.
* @return {Object} The new state.
*/export default function clientConnectivityReducer(){var state=arguments.length>0&&arguments[0]!==undefined?arguments[0]:defaultState;var action=arguments.length>1?arguments[1]:undefined;switch(action.type){case RECEIVE_CLIENT_CONNECTIVITY:return _extends({},state,{},defaultState,{},action.data);default:return state;}}