File "reducer.js"

Full Path: /home/warrior1/public_html/languages/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-wordads/src/dashboard/components/global-notices/store/reducer.js
File size: 425 bytes
MIME-type: text/x-java
Charset: utf-8

import { CREATE_NOTICE, REMOVE_NOTICE } from './actions';

const notices = ( state = { notices: [] }, action ) => {
	switch ( action.type ) {
		case CREATE_NOTICE:
			return {
				...state,
				notices: [ ...state.notices, action.notice ],
			};
		case REMOVE_NOTICE:
			return {
				...state,
				notices: state.notices.filter( notice => notice.id !== action.notice.id ),
			};
	}
	return state;
};

export default notices;