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

add FolderSelect

This commit is contained in:
Dick Choi
2016-05-31 14:29:01 +09:00
parent 549930b48c
commit 4fdb72f93c
7 changed files with 376 additions and 29 deletions

View File

@@ -33,6 +33,11 @@ function repositories (state = initialRepositories, action) {
console.info('REDUX >> ', action)
switch (action.type) {
case 'INIT_ALL':
action.data.forEach((repo) => {
repo.notes.forEach((note) => {
note._repository = repo
})
})
return action.data.slice()
case 'ADD_REPOSITORY':
{
@@ -113,6 +118,7 @@ function repositories (state = initialRepositories, action) {
let targetRepo = _.find(repos, {key: action.repository})
if (targetRepo == null) return state
action.note._repository = targetRepo
targetRepo.notes.push(action.note)
return repos
@@ -126,6 +132,8 @@ function repositories (state = initialRepositories, action) {
let targetNoteIndex = _.findIndex(targetRepo.notes, {key: action.note.key})
action.note.updatedAt = Date.now()
action.note._repository = targetRepo
if (targetNoteIndex > -1) {
targetRepo.notes.splice(targetNoteIndex, 1, action.note)
} else {