1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-15 02:36:36 +00:00

change how to use dataApi and fix indent

This commit is contained in:
Sosuke Suzuki
2017-04-25 02:31:03 +09:00
parent b73f0a8012
commit f8b7b7df9f

View File

@@ -148,20 +148,9 @@ class StorageItem extends React.Component {
const noteData = JSON.parse(e.dataTransfer.getData('note'))
const newNoteData = Object.assign({}, noteData, {storage: storage, folder: folder.key})
if(folder.key === noteData.folder) return
console.log(location)
dataApi
.createNote(storage.key, newNoteData)
.then((note) => {
dispatch({
type: 'UPDATE_NOTE',
note: note
})
hashHistory.push({
pathname: location.pathname,
query: {key: note.storage + '-' + note.key}
})
})
dataApi
.deleteNote(noteData.storage, noteData.key)
.then((data) => {
@@ -175,7 +164,18 @@ class StorageItem extends React.Component {
eventEmitter.once('list:moved', dispatchHandler)
eventEmitter.emit('list:next')
})
.catch((err) => {
console.error(err)
})
dispatch({
type: 'UPDATE_NOTE',
note: note
})
hashHistory.push({
pathname: location.pathname,
query: {key: note.storage + '-' + note.key}
})
})
}
render () {