Created NotionPages store

This commit is contained in:
Julien Nahum
2024-01-02 17:06:55 +01:00
parent d1d8e62abb
commit b3740dc1c3
5 changed files with 66 additions and 52 deletions

View File

@@ -1,5 +1,8 @@
<template>
<notion-renderer :block-map="blockMap"/>
<notion-renderer v-if="!loading" :block-map="blockMap"/>
<div class="p-6 flex items-center justify-center" v-else>
<loader class="w-6 h-6"/>
</div>
</template>
<script>
@@ -9,21 +12,14 @@ export default {
name: 'NotionPage',
components: {NotionRenderer},
props: {
pageId: {
type: String,
blockMap: {
type: Object
},
loading: {
type: Boolean,
required: true
}
},
async setup(props) {
const apiUrl = useAppConfig().notion.worker
const {data} = await useFetch(`${apiUrl}/page/${props.pageId}`)
return {
apiUrl: useAppConfig().notion.worker,
blockMap: data,
}
}
}
</script>