Created NotionPages store
This commit is contained in:
parent
d1d8e62abb
commit
b3740dc1c3
|
@ -1,5 +1,8 @@
|
||||||
<template>
|
<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>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -9,21 +12,14 @@ export default {
|
||||||
name: 'NotionPage',
|
name: 'NotionPage',
|
||||||
components: {NotionRenderer},
|
components: {NotionRenderer},
|
||||||
props: {
|
props: {
|
||||||
pageId: {
|
blockMap: {
|
||||||
type: String,
|
type: Object
|
||||||
|
},
|
||||||
|
loading: {
|
||||||
|
type: Boolean,
|
||||||
required: true
|
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>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -5,30 +5,25 @@
|
||||||
<h1 class="sm:text-5xl mb-4">
|
<h1 class="sm:text-5xl mb-4">
|
||||||
Integrations
|
Integrations
|
||||||
</h1>
|
</h1>
|
||||||
<NotionPage class="mb-8 integration-page" page-id="492c2bbb31404481b9faaaf407e59640" />
|
<NotionPage :block-map="blockMap" :loading="loading" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<open-form-footer/>
|
<open-form-footer/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
export default {
|
// metaTitle: { type: String, default: 'Integrations' },
|
||||||
layout: 'default',
|
// metaDescription: { type: String, default: 'You can connect your OpnForms to other services via our two integrations: Zapier and Webhooks. Use our integrations to automate your various workflows.' }
|
||||||
|
|
||||||
props: {
|
import {useNotionPagesStore} from "~/stores/notion_pages.js";
|
||||||
metaTitle: { type: String, default: 'Integrations' },
|
import {computed} from "vue";
|
||||||
metaDescription: { type: String, default: 'You can connect your OpnForms to other services via our two integrations: Zapier and Webhooks. Use our integrations to automate your various workflows.' }
|
|
||||||
},
|
|
||||||
|
|
||||||
data: () => ({
|
const notionPageStore = useNotionPagesStore()
|
||||||
}),
|
await notionPageStore.load('492c2bbb31404481b9faaaf407e59640')
|
||||||
|
|
||||||
computed: {},
|
const loading = computed(() => notionPageStore.loading)
|
||||||
|
const blockMap = computed(() => notionPageStore.getByKey('492c2bbb31404481b9faaaf407e59640'))
|
||||||
mounted () {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|
|
@ -5,25 +5,23 @@
|
||||||
<h1 class="sm:text-5xl">
|
<h1 class="sm:text-5xl">
|
||||||
Privacy Policy
|
Privacy Policy
|
||||||
</h1>
|
</h1>
|
||||||
<NotionPage page-id="9c97349ceda7455aab9b341d1ff70f79" />
|
<NotionPage :block-map="blockMap" :loading="loading" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<open-form-footer />
|
<open-form-footer />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
|
|
||||||
export default {
|
// metaTitle: 'Privacy Policy',
|
||||||
layout: 'default',
|
|
||||||
|
|
||||||
data: () => ({
|
import {useNotionPagesStore} from "~/stores/notion_pages.js";
|
||||||
metaTitle: 'Privacy Policy',
|
import {computed} from "vue";
|
||||||
}),
|
|
||||||
|
|
||||||
computed: {},
|
const notionPageStore = useNotionPagesStore()
|
||||||
|
await notionPageStore.load('9c97349ceda7455aab9b341d1ff70f79')
|
||||||
|
|
||||||
mounted () {
|
const loading = computed(() => notionPageStore.loading)
|
||||||
}
|
const blockMap = computed(() => notionPageStore.getByKey('9c97349ceda7455aab9b341d1ff70f79'))
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -5,24 +5,22 @@
|
||||||
<h1 class="sm:text-5xl">
|
<h1 class="sm:text-5xl">
|
||||||
Terms & Conditions
|
Terms & Conditions
|
||||||
</h1>
|
</h1>
|
||||||
<NotionPage page-id="246420da2834480ca04047b0c5a00929" />
|
<NotionPage :block-map="blockMap" :loading="loading" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<open-form-footer/>
|
<open-form-footer/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
export default {
|
// metaTitle: 'Terms & Conditions',
|
||||||
layout: 'default',
|
|
||||||
|
|
||||||
data: () => ({
|
import {useNotionPagesStore} from "~/stores/notion_pages.js";
|
||||||
metaTitle: 'Terms & Conditions',
|
import {computed} from "vue";
|
||||||
}),
|
|
||||||
|
|
||||||
computed: {},
|
const notionPageStore = useNotionPagesStore()
|
||||||
|
await notionPageStore.load('246420da2834480ca04047b0c5a00929')
|
||||||
|
|
||||||
mounted () {
|
const loading = computed(() => notionPageStore.loading)
|
||||||
}
|
const blockMap = computed(() => notionPageStore.getByKey('246420da2834480ca04047b0c5a00929'))
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
import {defineStore} from 'pinia'
|
||||||
|
import {useContentStore} from "~/composables/stores/useContentStore.js";
|
||||||
|
|
||||||
|
export const useNotionPagesStore = defineStore('notion_pages', () => {
|
||||||
|
|
||||||
|
const contentStore = useContentStore()
|
||||||
|
|
||||||
|
const load = (pageId) => {
|
||||||
|
contentStore.startLoading()
|
||||||
|
|
||||||
|
const apiUrl = useAppConfig().notion.worker
|
||||||
|
return useOpnApi(`${apiUrl}/page/${pageId}`)
|
||||||
|
.then(({data})=> {
|
||||||
|
const val = data.value
|
||||||
|
val['id'] = pageId
|
||||||
|
contentStore.save(val)
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
contentStore.stopLoading()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
...contentStore,
|
||||||
|
load
|
||||||
|
}
|
||||||
|
})
|
Loading…
Reference in New Issue