diff options
Diffstat (limited to 'client/reducers/newFolder.js')
| -rw-r--r-- | client/reducers/newFolder.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/client/reducers/newFolder.js b/client/reducers/newFolder.js new file mode 100644 index 0000000..5c0f40d --- /dev/null +++ b/client/reducers/newFolder.js @@ -0,0 +1,32 @@ +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 |
