Skip to content

Commit

Permalink
improve: Update module meta and fix undefined error (#235)
Browse files Browse the repository at this point in the history
* improve: Update module meta and fix undefined error

* update-module-meta: Add optional chaining
  • Loading branch information
vloss3 authored May 17, 2024
1 parent 36d125a commit f94081b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default defineNuxtModule<ModuleOptions>({
name: 'nuxtjs-drupal-ce',
configKey: 'drupalCe',
compatibility: {
nuxt: '^3.2.2',
nuxt: '^3.7.0',
},
},
defaults: {
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/composables/useDrupalCe/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const useDrupalCe = () => {
const useCeApi = (path: string | Ref<string>, fetchOptions: UseFetchOptions<any> = {}, doPassThroughHeaders?: boolean): Promise<any> => {
const nuxtApp = useNuxtApp()
fetchOptions.onResponse = (context) => {
if (doPassThroughHeaders && privateConfig.passThroughHeaders && import.meta.server) {
if (doPassThroughHeaders && import.meta.server && privateConfig?.passThroughHeaders) {
const headersObject = Object.fromEntries([...context.response.headers.entries()])
passThroughHeaders(nuxtApp, headersObject)
}
Expand Down Expand Up @@ -221,7 +221,7 @@ export const useDrupalCe = () => {
const event = nuxtApp.ssrContext.event
if (pageHeaders) {
Object.keys(pageHeaders).forEach((key) => {
if (privateConfig.passThroughHeaders.includes(key)) {
if (privateConfig?.passThroughHeaders.includes(key)) {
appendResponseHeader(event, key, pageHeaders[key])
}
})
Expand Down

0 comments on commit f94081b

Please sign in to comment.