Sindbad~EG File Manager

Current Path : /home/frekansk/www/wp-content/plugins/learnpress/assets/src/apps/js/frontend/modal/store/
Upload File :
Current File : /home/frekansk/www/wp-content/plugins/learnpress/assets/src/apps/js/frontend/modal/store/reducer.js

const STORE_DATA = {};

export const Modal = ( state = STORE_DATA, action ) => {
	switch ( action.type ) {
	case 'SHOW_MODAL':
		return {
			...state,
			isOpen: true,
			message: action.message,
			cb: action.cb,
		};
	case 'HIDE_MODAL':
		return {
			...state,
			isOpen: false,
			message: false,
			cb: null,
		};
	case 'CONFIRM':
		state.cb &&
				setTimeout( () => {
					state.cb();
				}, 10 );

		return {
			...state,
			confirm: action.value,
		};
	}
	return state;
};

export default Modal;

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists