mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 01:36:22 +00:00
add FolderSelect
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user