drunomics / nuxtjs-drupal-ce

A Nuxt module to easily connect Drupal via custom elements.
https://lupus-decoupled.org/
MIT License
22 stars 4 forks source link

Page data is initially undefined when using getPage helper #136

Closed TurtlBbx closed 1 year ago

TurtlBbx commented 1 year ago

When using getPage helper outside of NuxtPage, initial page data is undefined. So when trying to access page data in a Layout for example, we get a typeerror:

<template>
  <div>
    <NuxtLayout :name="page.page_layout">
      <NuxtPage />
    </NuxtLayout>
  </div>
</template>

<script setup>
const { getPage } = useDrupalCe()
const page = getPage()
</script>

We should set default value in getPage helper code. This should also resolve the error when using Breadcrumbs outside of NuxtPage.