about summary refs log tree commit diff
path: root/pages
diff options
context:
space:
mode:
authorPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2019-10-17 21:08:25 +0200
committerPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2019-10-17 21:08:25 +0200
commitedb6cb5adc69c8f2131b7b309d91a53e21af2486 (patch)
tree0387b78df50fbb69ef0b597d2dcdfc4913c337a5 /pages
parente81210cefcc34cd68f1a49c0f8146e08ffd01c24 (diff)
downloadpuszcza-edb6cb5adc69c8f2131b7b309d91a53e21af2486.tar.gz
puszcza-edb6cb5adc69c8f2131b7b309d91a53e21af2486.zip
Revert "Revert "Add kronikarz""
This reverts commit 4fe5fef70b111ab0e10d91ee7060302a52ca3b76.
Diffstat (limited to 'pages')
-rw-r--r--pages/kronika/_year/_month/_day/_title/index.vue17
1 files changed, 6 insertions, 11 deletions
diff --git a/pages/kronika/_year/_month/_day/_title/index.vue b/pages/kronika/_year/_month/_day/_title/index.vue
index f4d5cc0..a8a086a 100644
--- a/pages/kronika/_year/_month/_day/_title/index.vue
+++ b/pages/kronika/_year/_month/_day/_title/index.vue
@@ -15,24 +15,19 @@
 <script>
 const md = require('markdown-it')()
 import frontmatter from 'front-matter'
-import { getPostAttributes } from '~/api/api'
+import k from '~/api'
 
 export default {
   async asyncData({ params }) {
-    const fileContent = await import(
-      `~/content/wpisy/${params.year}/${params.month}/${
-        params.day
-      }/${params.title.toLowerCase()}.md`
-    ).catch(e => console.log(e))
+    const { year, month, day, title } = params
+    const post = k.getPost(year, month, day, title)
 
-    if (fileContent === undefined) return { notFound: true }
-
-    const post = getPostAttributes(fileContent.default)
+    if (post === undefined) return { notFound: true }
 
     return {
       params,
-      attributes: post.attributes,
-      content: post.body
+      attributes: post.content.meta,
+      content: post.content.html
     }
   },
   data() {