about summary refs log tree commit diff
path: root/pages/kronika/_year
diff options
context:
space:
mode:
authorPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2019-10-14 10:03:47 +0200
committerPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2019-10-14 10:03:47 +0200
commitd400b53bee9ba563810171c217710d4176b7c367 (patch)
tree49f339a0c05a51fedcf4d741d9828f63ab0046d3 /pages/kronika/_year
parent5cfbd5b71d149419b0b80056e652ca94d26f1a95 (diff)
downloadpuszcza-d400b53bee9ba563810171c217710d4176b7c367.tar.gz
puszcza-d400b53bee9ba563810171c217710d4176b7c367.zip
Add kronikarz
Diffstat (limited to 'pages/kronika/_year')
-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() {