1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-23 22:51:42 +00:00

UPDATE_FOLDER & DELETE_FOLDER

fix store bug when creating note
This commit is contained in:
Dick Choi
2016-09-02 09:33:01 +09:00
parent 4ee49d5991
commit a391ac682d
5 changed files with 88 additions and 31 deletions

View File

@@ -7,8 +7,7 @@ import dataApi from 'browser/main/lib/dataApi'
import store from 'browser/main/store'
const electron = require('electron')
const { shell, remote } = electron
const { Menu, MenuItem } = remote
const { shell } = electron
import { SketchPicker } from 'react-color'
class UnstyledFolderItem extends React.Component {
@@ -42,10 +41,10 @@ class UnstyledFolderItem extends React.Component {
color: this.state.folder.color,
name: this.state.folder.name
})
.then((storage) => {
.then((data) => {
store.dispatch({
type: 'UPDATE_STORAGE',
storage: storage
type: 'UPDATE_FOLDER',
storage: data.storage
})
this.setState({
status: 'IDLE'
@@ -146,12 +145,12 @@ class UnstyledFolderItem extends React.Component {
handleDeleteConfirmButtonClick (e) {
let { storage, folder } = this.props
dataApi
.removeFolder(storage.key, folder.key)
.then((storage) => {
.deleteFolder(storage.key, folder.key)
.then((data) => {
store.dispatch({
type: 'REMOVE_FOLDER',
key: folder.key,
storage: storage
type: 'DELETE_FOLDER',
storage: data.storage,
folderKey: data.folderKey
})
})
}
@@ -257,10 +256,10 @@ class StorageItem extends React.Component {
}
dataApi.createFolder(storage.key, input)
.then((storage) => {
.then((data) => {
store.dispatch({
type: 'ADD_FOLDER',
storage: storage
type: 'UPDATE_FOLDER',
storage: data.storage
})
})
.catch((err) => {

View File

@@ -51,10 +51,10 @@ class StoragesTab extends React.Component {
}
renderList () {
let { storages, boundingBox } = this.props
let { data, boundingBox } = this.props
if (!boundingBox) { return null }
let storageList = storages.map((storage) => {
let storageList = data.storageMap.map((storage) => {
return <StorageItem
key={storage.key}
storage={storage}