Tried some updates

This commit is contained in:
Henrik Larsson 2023-08-13 14:40:19 +02:00
parent 4e9323a1e0
commit d00eff7694
7 changed files with 0 additions and 12 deletions

View File

@ -1,6 +1,5 @@
import { import {
categoryQuery, categoryQuery,
homePageQuery,
pageQuery, pageQuery,
productQuery productQuery
} from '@/lib/sanity/queries'; } from '@/lib/sanity/queries';
@ -8,22 +7,11 @@ import { groq } from 'next-sanity';
const getQueryFromSlug = (slugArray: string[], locale: string) => { const getQueryFromSlug = (slugArray: string[], locale: string) => {
const docQuery: { [index: string]: string } = { const docQuery: { [index: string]: string } = {
'home': groq`${homePageQuery}`,
'product': groq`${productQuery}`, 'product': groq`${productQuery}`,
'category': groq`${categoryQuery}`, 'category': groq`${categoryQuery}`,
'page': groq`${pageQuery}`, 'page': groq`${pageQuery}`,
} }
if (!slugArray) {
return {
docType: "home",
queryParams: {
locale: locale
},
query: docQuery.home,
}
}
let docType = '' let docType = ''
const [slugStart] = slugArray const [slugStart] = slugArray