[+] Fetch publications

This commit is contained in:
Hykilpikonna
2021-12-25 12:08:09 -05:00
parent 9dccc0c362
commit 891954cb1a
2 changed files with 13 additions and 4 deletions
@@ -1,11 +1,12 @@
<template> <template>
<div id="Publishing"> <div id="Publication">
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import {Options, Vue} from 'vue-class-component'; import {Options, Vue} from 'vue-class-component';
import {Prop} from "vue-property-decorator";
export interface ZoteroLink export interface ZoteroLink
{ {
@@ -60,9 +61,9 @@ export interface ZoteroItem
} }
@Options({components: {}}) @Options({components: {}})
export default class Publishing extends Vue export default class ZoteroPublicationView extends Vue
{ {
@Prop({required: true}) item!: ZoteroItem
} }
</script> </script>
+9 -1
View File
@@ -1,6 +1,8 @@
<template> <template>
<div id="About" class="markdown-content"> <div id="About" class="markdown-content">
<Dynamic :template="html"></Dynamic> <Dynamic :template="html"></Dynamic>
<ZoteroPublication v-for="item in publications" :key="item.key" :item="item"/>
</div> </div>
</template> </template>
@@ -11,11 +13,13 @@ import emojiRegex from 'emoji-regex';
import {parseExtensions} from '@/scripts/extended_markdown' import {parseExtensions} from '@/scripts/extended_markdown'
import $ from 'jquery' import $ from 'jquery'
import 'jqueryui' import 'jqueryui'
import ZoteroPublication, {ZoteroItem} from "@/components/ZoteroPublication.vue";
@Options({components: {}}) @Options({components: {ZoteroPublication}})
export default class About extends Vue export default class About extends Vue
{ {
html = "" html = ""
publications: ZoteroItem[] = []
mounted(): void mounted(): void
{ {
@@ -24,6 +28,10 @@ export default class About extends Vue
.then(it => this.html = marked(parseExtensions(it.replace(emojiRegex(), (emoji) => { .then(it => this.html = marked(parseExtensions(it.replace(emojiRegex(), (emoji) => {
return `<span class="emoji">${emoji}</span>` return `<span class="emoji">${emoji}</span>`
})))) }))))
// Fetch publications from zotero TODO: CDN
fetch('https://api.zotero.org/hykilpikonna/publications/items?linkwrap=1&order=date&sort=desc&start=0&include=data&limit=100')
.then(it => it.json()).then(it => this.publications = it)
} }
updated(): void updated(): void