storyblok / storyblok-nuxt-2

6 stars 8 forks source link

Cannot destructure property 'story' of 'Object(...)(...)' as it is undefined. #8

Closed jamaluddinrumi closed 2 years ago

jamaluddinrumi commented 2 years ago

i can not use the useStoryblok one-liner composable.

index.js

<script>
import { useStoryblok } from "@storyblok/nuxt-2";

export default {
  name: "HomePage",
  scrollToTop: true,

  setup() {
    const { story, fetchState } = useStoryblok("cdn/stories/halaman-depan", {
      version: "draft",
    });

    return {
      story,
      fetchState,
    };
  },
...

nuxt.config.js

buildModules: [
    [
      "@nuxtjs/composition-api/module",
      "@storyblok/nuxt-2/module",
      {
        accessToken: process.env.STORYBLOK_API_KEY,
        // cacheProvider: "memory",
        bridge: true,
        apiOptions: {}, // storyblok-js-client options
        useApiClient: true,
      },
    ],
...

Screen Shot 2022-05-20 at 7 52 48 AM

Screen Shot 2022-05-20 at 7 52 29 AM

i also can not use the options api.

jamaluddinrumi commented 2 years ago

up

jamaluddinrumi commented 2 years ago

i followed this article and it works by deleting node_modules and generate it once again

it's now resolved