Skip to content

Commit

Permalink
navigate on delete
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenGrider committed Jan 25, 2016
1 parent 3722787 commit 698627d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions blog/src/components/posts_show.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import React, { Component } from 'react';
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { fetchPost, deletePost } from '../actions/index';
import { Link } from 'react-router';

class PostsShow extends Component {
static contextTypes = {
router: PropTypes.object
};

componentWillMount() {
this.props.fetchPost(this.props.params.id);
}

onDeleteClick() {
this.props.deletePost(this.props.params.id);
this.props.deletePost(this.props.params.id)
.then(() => { this.context.router.push('/'); });
}

render() {
Expand Down

0 comments on commit 698627d

Please sign in to comment.