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:
@@ -65,12 +65,20 @@ class TopBar extends React.Component {
|
||||
return repo.addNote(newNote)
|
||||
})
|
||||
.then((note) => {
|
||||
let { dispatch } = this.props
|
||||
let { dispatch, location } = this.props
|
||||
let { router } = this.context
|
||||
dispatch({
|
||||
type: 'ADD_NOTE',
|
||||
repository: repositoryKey,
|
||||
note: note
|
||||
})
|
||||
|
||||
router.push({
|
||||
pathname: location.pathname,
|
||||
query: {
|
||||
key: `${note._repository.key}-${note.key}`
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
@@ -139,6 +147,12 @@ class TopBar extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
TopBar.contextTypes = {
|
||||
router: PropTypes.shape({
|
||||
push: PropTypes.func
|
||||
})
|
||||
}
|
||||
|
||||
TopBar.propTypes = {
|
||||
dispatch: PropTypes.func,
|
||||
config: PropTypes.shape({
|
||||
|
||||
Reference in New Issue
Block a user