mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-11 18:32:50 +00:00
fixed routing
This commit is contained in:
@@ -3,6 +3,9 @@ import marked from 'marked';
|
||||
import React from 'react';
|
||||
import {Link} from 'react-router';
|
||||
|
||||
//components
|
||||
import Loading from './utils/Loading';
|
||||
|
||||
import '../../assets/scss/Content.scss';
|
||||
|
||||
const renderer = new marked.Renderer();
|
||||
@@ -16,13 +19,25 @@ marked.setOptions({
|
||||
|
||||
export default class Post extends React.Component {
|
||||
|
||||
componentDidMount() {
|
||||
const params = this.props.params;
|
||||
this.props.actions.fetchPost(params.category, params.post);
|
||||
}
|
||||
|
||||
render() {
|
||||
const post = this.props.redux.post;
|
||||
const fetched = this.props.redux.fetched;
|
||||
const fetching = this.props.redux.fetching;
|
||||
|
||||
return (
|
||||
<div class="Content">
|
||||
<div dangerouslySetInnerHTML={{__html : marked(this.props.content, {renderer : renderer})}}>
|
||||
{fetched ?
|
||||
<div>
|
||||
<div dangerouslySetInnerHTML={{__html : marked(post, {renderer : renderer})}}/>
|
||||
<Link to="/" class="link"><i class="fa fa-caret-left" aria-hidden="true"></i> Home</Link>
|
||||
</div>
|
||||
: <Loading/>}
|
||||
</div>
|
||||
<Link to="/" class="link"><i class="fa fa-caret-left" aria-hidden="true"></i> Home</Link>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user