1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-13 19:12:49 +00:00

fixed end point - fixed posts in metadata

This commit is contained in:
2016-09-13 04:37:56 +00:00
parent e558fe5da2
commit e5d340df5d
10 changed files with 102 additions and 18 deletions

View File

@@ -44,10 +44,14 @@ export function fetchPreview() {
}
}
export function fetchPost(category, post) {
//adjust url according to parameters
//mainly used to load md files in the parent directory within /posts
export function fetchPost(post, category = null) {
let url;
return (dispatch) => {
dispatch(fetching());
return fetch(`/public/posts/${category}/${post}.md`)
url = category !== null || typeof category === 'undefined' ? `/public/posts/${category}/${post}.md` : `/public/posts/${post}.md`;
return fetch(url)
.then(response => response.text())
.then(response => {
dispatch(loadPost(response));