1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-14 02:06:29 +00:00

add folder create

This commit is contained in:
Rokt33r
2015-10-24 21:32:53 +09:00
parent 911cfd8642
commit 5ed2dfccd1
5 changed files with 115 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
import { combineReducers } from 'redux'
import { findIndex } from 'lodash'
import { SWITCH_USER, SWITCH_FOLDER, SWITCH_MODE, SWITCH_ARTICLE, SET_SEARCH_FILTER, SET_TAG_FILTER, USER_UPDATE, ARTICLE_REFRESH, ARTICLE_UPDATE, ARTICLE_DESTROY, IDLE_MODE, CREATE_MODE } from './actions'
import { SWITCH_USER, SWITCH_FOLDER, SWITCH_MODE, SWITCH_ARTICLE, SET_SEARCH_FILTER, SET_TAG_FILTER, USER_UPDATE, ARTICLE_REFRESH, ARTICLE_UPDATE, ARTICLE_DESTROY, FOLDER_DESTROY, IDLE_MODE, CREATE_MODE } from './actions'
import auth from 'boost/auth'
const initialStatus = {
@@ -116,6 +116,17 @@ function articles (state, action) {
state[teamKey] = articles
}
return state
case FOLDER_DESTROY:
{
let { userId, folderId } = action.data
let teamKey = genKey(userId)
let articles = JSON.parse(localStorage.getItem(teamKey))
articles = articles.filter(article => article.FolderId !== folderId)
localStorage.setItem(teamKey, JSON.stringify(articles))
state[teamKey] = articles
}
return state
default:
if (state == null) return getInitialArticles()
return state