File "shared-context-reducer.js"

Full Path: /home/warrior1/public_html/wp-content/plugins/elementor/app/modules/import-export/assets/js/context/shared-context/shared-context-reducer.js
File size: 725 bytes
MIME-type: text/x-java
Charset: utf-8

import { ReducerUtils } from '../utils/reducer-utils';

export const reducer = ( state, { type, payload } ) => {
	switch ( type ) {
		case 'ADD_INCLUDE':
			return ReducerUtils.updateArray( state, 'includes', payload, 'add' );
		case 'REMOVE_INCLUDE':
			return ReducerUtils.updateArray( state, 'includes', payload, 'remove' );
		case 'SET_REFERRER':
			return { ...state, referrer: payload };
		case 'SET_INCLUDES':
			return { ...state, includes: payload };
		case 'SET_CPT':
			return { ...state, customPostTypes: payload };
		case 'SET_SELECTED_CPT':
			return { ...state, selectedCustomPostTypes: payload };
		case 'SET_CURRENT_PAGE_NAME':
			return { ...state, currentPage: payload };
		default:
			return state;
	}
};