mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
redirect when create new note
This commit is contained in:
@@ -89,7 +89,8 @@ class Main extends React.Component {
|
|||||||
'dispatch',
|
'dispatch',
|
||||||
'repositories',
|
'repositories',
|
||||||
'config',
|
'config',
|
||||||
'params'
|
'params',
|
||||||
|
'location'
|
||||||
])}
|
])}
|
||||||
/>
|
/>
|
||||||
<div styleName={config.isSideNavFolded ? 'body--expanded' : 'body'}
|
<div styleName={config.isSideNavFolded ? 'body--expanded' : 'body'}
|
||||||
|
|||||||
@@ -65,12 +65,20 @@ class TopBar extends React.Component {
|
|||||||
return repo.addNote(newNote)
|
return repo.addNote(newNote)
|
||||||
})
|
})
|
||||||
.then((note) => {
|
.then((note) => {
|
||||||
let { dispatch } = this.props
|
let { dispatch, location } = this.props
|
||||||
|
let { router } = this.context
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'ADD_NOTE',
|
type: 'ADD_NOTE',
|
||||||
repository: repositoryKey,
|
repository: repositoryKey,
|
||||||
note: note
|
note: note
|
||||||
})
|
})
|
||||||
|
|
||||||
|
router.push({
|
||||||
|
pathname: location.pathname,
|
||||||
|
query: {
|
||||||
|
key: `${note._repository.key}-${note.key}`
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
@@ -139,6 +147,12 @@ class TopBar extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TopBar.contextTypes = {
|
||||||
|
router: PropTypes.shape({
|
||||||
|
push: PropTypes.func
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
TopBar.propTypes = {
|
TopBar.propTypes = {
|
||||||
dispatch: PropTypes.func,
|
dispatch: PropTypes.func,
|
||||||
config: PropTypes.shape({
|
config: PropTypes.shape({
|
||||||
|
|||||||
Reference in New Issue
Block a user