janniks / vue-notion

A fast Vue renderer for Notion pages
https://vue-notion.now.sh
Other
883 stars 63 forks source link

Error : Route not found #21

Closed frama21 closed 3 years ago

frama21 commented 3 years ago

i use Nuxtjs 2.15.2 i got error in my template like this image

i implement the code via async fetch() using notion-api-worker

    async fetch() {
      this.articles = await this.$nuxt.$notion.getPageBlocks(
        'https://notion-api.splitbee.io/v1/page/' + link
      )
  },

is this package not support custom link or i make wrong in implement to my code?, any suggest, help, or example in implement i'm really apreciate it. Oh BTW thanks for a great package! really helpful !

janniks commented 3 years ago

Hi 👋 Thanks for checking out vue-notion

You can check out this example using async fetch that might help. The getPageBlocks method accepts a pageId (uuid) directly. You could specify a different API URL as a second parameter; as shown below.

const pageId = "8c1ab01960b049f6a282dda64a94afc7"

// these both do the same thing
this.articles = await this.$notion.getPageBlocks(pageId)
this.articles = await this.$notion.getPageBlocks(pageId, "https://api.vue-notion.workers.dev/v1")

// this would use the URL of splitbee
this.articles = await this.$notion.getPageBlocks(pageId, "https://notion-api.splitbee.io/v1")

In this example we also added a loading text — using the fetch hook might work a bit differently compared to asyncData. Although if you are deploying using static generation there should not be any real differences in the end result.

Hope it helps! ☀️ Let me know if there is anything else you need

frama21 commented 3 years ago

Oke, thanks for help i really apreciate, and thanks for great example too, maybe if i find a problem again i will make a issue or reopen this issue, thanks for everyhing @janniks