@devite/nuxt-sanity 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json
CHANGED
|
@@ -17,7 +17,7 @@ import type { Home } from '../types/singletons/Home'
|
|
|
17
17
|
import type { Page } from '../types/documents/Page'
|
|
18
18
|
import type { NotFound } from '../types/singletons/NotFound'
|
|
19
19
|
import type { GlobalSEO } from '../types/objects/global/GlobalSEO'
|
|
20
|
-
import {
|
|
20
|
+
import { IMAGE_WITHOUT_PREVIEW_PROJECTION } from '../utils/projections'
|
|
21
21
|
import { useHead, useRoute, useRuntimeConfig, useSeoMeta } from '#app'
|
|
22
22
|
import { computed } from '#imports'
|
|
23
23
|
|
|
@@ -25,12 +25,12 @@ const { baseURL } = useRuntimeConfig().public
|
|
|
25
25
|
|
|
26
26
|
const path = useRoute().fullPath
|
|
27
27
|
const groqFilter = path === '/' ? '_type == "home"' : `_type == "page" && slug.current == "${path.substring(1)}"`
|
|
28
|
-
const { data: sanityData } = await useSanityQuery<Home | Page | NotFound>(groq`*[(${groqFilter}) || _type == "notFound"][0] { _id, _type, title, modules, seo { _type, indexable, title, shortTitle, description, image ${
|
|
28
|
+
const { data: sanityData } = await useSanityQuery<Home | Page | NotFound>(groq`*[(${groqFilter}) || _type == "notFound"][0] { _id, _type, title, modules, seo { _type, indexable, title, shortTitle, description, image ${IMAGE_WITHOUT_PREVIEW_PROJECTION} } }`)
|
|
29
29
|
|
|
30
30
|
const seo = computed(() => sanityData.value?.seo)
|
|
31
31
|
const url = computed(() => baseURL + (sanityData.value?.slug || '/'))
|
|
32
32
|
|
|
33
|
-
const { data: globalSEO } = await useSanityQuery<GlobalSEO>(groq`*[_type == 'settings'][0].seo { siteName, image ${
|
|
33
|
+
const { data: globalSEO } = await useSanityQuery<GlobalSEO>(groq`*[_type == 'settings'][0].seo { siteName, image ${IMAGE_WITHOUT_PREVIEW_PROJECTION} }`)
|
|
34
34
|
const image: ComputedRef<ImageAsset> = computed(() => sanityData.value?.image?.asset || globalSEO.value?.image?.asset)
|
|
35
35
|
|
|
36
36
|
useHead({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useSanityQuery } from "@nuxtjs/sanity/runtime/composables";
|
|
2
2
|
import { IMAGE_ASSET_PROJECTION } from "./projections.js";
|
|
3
3
|
export const resolveImageAssetById = async (id) => {
|
|
4
|
-
return await useSanityQuery(`*[_type == "sanity.imageAsset" && _id == $assetId][0] ${IMAGE_ASSET_PROJECTION}`, { assetId: id });
|
|
4
|
+
return (await useSanityQuery(`*[_type == "sanity.imageAsset" && _id == $assetId][0] ${IMAGE_ASSET_PROJECTION}`, { assetId: id })).data.value;
|
|
5
5
|
};
|
package/package.json
CHANGED