import { connect } from 'react-redux';
import { default as columns } from '../reducers/boardColumn';
import { getColumns, addColumn } from '../actions/boardColumn';
import { ccStore$ } from '../reducers/boardColumn';
import BoardColumn from '../components/BoardColumn';
import api from '../services';

const mapStateToProps = (state, action) => {
	return {
		columns: state.columns
	}
}

const mapDispatchToProps = (dispatch) => {
	const maps = {
		getColumns: () => api.getColumns(dispatch),
		addColumn: async (item) => {
			dispatch(addColumn('REQUEST'));

			try {
				const column = await api.addColumn(item);
				dispatch(addColumn('SUCCESS', column));
			} catch(err) {
				dispatch(addColumn('FAILED'));
			} finally {
				maps.getColumns();
			}
		}
	}

	return maps;
}

const VisibleBoardColumn = connect(
  mapStateToProps,
  mapDispatchToProps
)(BoardColumn);

export default VisibleBoardColumn;
@@ -114,16 +114,72 @@
 Columns,
+ getColumnsRequest, getColumnsSuccess, getColumnsFailed,
  addColu
@@ -206,32 +206,32 @@
 s/boardColumn';%0A
-
 import %7B ccStore
@@ -520,32 +520,383 @@
  =%3E 
-api.getColumns(dispatch)
+%7B%0A%09%09%09let columns = api.getStorage('columns');%0A%09%09%09if (!columns %7C%7C Object.keys(columns).length == 0) %7B%0A%09%09%09%09let observer = %7B%0A%09%09%09%09%09next: (res) =%3E res.json().then(data =%3E dispatch(getColumnsSuccess(data))),%0A%09%09%09%09%09error: (err) =%3E dispatch(getColumnsFailed()),%0A%09%09%09%09%09completed: () =%3E %7B%7D%0A%09%09%09%09%7D%0A%09%09%09%09api.getColumns(observer);%0A%09%09%09%7D else %7B%0A%09%09%09%09dispatch(getColumnsSuccess(columns))%0A%09%09%09%7D%0A%09%09%7D
 ,%0A%09%09

check sessionStorage in container and set observer for api