import client from '../client' const newFolder = (state = {}, action) => { switch (action.type) { case 'INIT_NEW_FOLDER': return { name: '', visible: true, } case 'CANCEL_NEW_FOLDER': return { name: '', visible: false, } case 'CREATE_NEW_FOLDER': if (action.name) { client.folder.create({ name: action.name }) .then(action.cb) } return { name: '', visible: false, } default: return state } } export default newFolder