1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

// filterを使うと確実にFolder名が一致するもののみを表示する

This commit is contained in:
Rokt33r
2015-11-15 23:20:06 +09:00
parent bbc3c85212
commit b28b18a19a
4 changed files with 73 additions and 29 deletions

View File

@@ -29,7 +29,8 @@ function folders (state = initialFolders, action) {
updatedAt: new Date()
})
if (newFolder.length === 0) throw new Error('Folder name is required')
if (newFolder.name == null && newFolder.name.length === 0) throw new Error('Folder name is required')
if (newFolder.name.match(/\//)) throw new Error('`/` is not available for folder name')
let conflictFolder = _.findWhere(state, {name: newFolder.name})
if (conflictFolder != null) throw new Error(`${newFolder.name} already exists!`)
@@ -129,7 +130,7 @@ function status (state = initialStatus, action) {
return state
case SWITCH_FOLDER:
state.mode = IDLE_MODE
state.search = `/${action.data} `
state.search = `//${action.data} `
return state
case SWITCH_MODE: