mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
Detail
This commit is contained in:
@@ -115,6 +115,22 @@ function repositories (state = initialRepositories, action) {
|
||||
if (targetRepo == null) return state
|
||||
targetRepo.notes.push(action.note)
|
||||
|
||||
return repos
|
||||
}
|
||||
case 'SAVE_NOTE':
|
||||
{
|
||||
let repos = state.slice()
|
||||
let targetRepo = _.find(repos, {key: action.repository})
|
||||
|
||||
if (targetRepo == null) return state
|
||||
|
||||
let targetNoteIndex = _.findIndex(targetRepo.notes, {key: action.note.key})
|
||||
if (targetNoteIndex > -1) {
|
||||
targetRepo.notes.splice(targetNoteIndex, 1, action.note)
|
||||
} else {
|
||||
targetRepo.notes.push(action.note)
|
||||
}
|
||||
|
||||
return repos
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user