diff --git a/app/[page]/opengraph-image.tsx b/app/[page]/opengraph-image.tsx index 2fd59281e..2ef90586e 100644 --- a/app/[page]/opengraph-image.tsx +++ b/app/[page]/opengraph-image.tsx @@ -1,11 +1,8 @@ import OpengraphImage from 'components/opengraph-image'; -import { getPage } from 'lib/shopify'; export const runtime = 'edge'; -export default async function Image({ params }: { params: { page: string } }) { - const page = await getPage(params.page); - const title = page.seo?.title || page.title; - +export default async function Image({}: { params: { page: string } }) { + const title = process.env.SITE_NAME || 'Payload Store'; return await OpengraphImage({ title }); } diff --git a/app/opengraph-image.tsx b/app/opengraph-image.tsx index fb317b2dc..23762cbdd 100644 --- a/app/opengraph-image.tsx +++ b/app/opengraph-image.tsx @@ -3,6 +3,5 @@ import OpengraphImage from 'components/opengraph-image'; export const runtime = 'edge'; export default async function Image() { - const title = process.env.SITE_NAME || 'Payload Store'; - return await OpengraphImage({ title }); + return await OpengraphImage(); } diff --git a/lib/shopify/index.ts b/lib/shopify/index.ts index 90397c93b..f64be61ce 100644 --- a/lib/shopify/index.ts +++ b/lib/shopify/index.ts @@ -164,8 +164,8 @@ const reshapeImage = (media: PayloadMedia): Image => { return { url: media.url!, altText: media.alt, - width: media.width, - height: media.height + width: media.width ?? 0, + height: media.height ?? 0 }; }; @@ -247,9 +247,7 @@ const reshapeProduct = (product: PayloadProduct): Product => { export async function getCollectionProducts({ collection, - tag, - reverse, - sortKey + tag }: { collection?: string; tag?: string; @@ -327,6 +325,7 @@ export async function getMenu(handle: string): Promise { } } +// eslint-disable-next-line no-unused-vars export async function getPage(handle: string): Promise { return undefined; } @@ -340,14 +339,13 @@ export async function getProduct(handle: string): Promise { return reshapeProduct(product); } +// eslint-disable-next-line no-unused-vars export async function getProductRecommendations(productId: string): Promise { return []; } export async function getProducts({ - query, - reverse, - sortKey + query }: { query?: string; reverse?: boolean; diff --git a/lib/shopify/payload-types.ts b/lib/shopify/payload-types.ts index d45726bcd..e938b4f7d 100644 --- a/lib/shopify/payload-types.ts +++ b/lib/shopify/payload-types.ts @@ -223,7 +223,3 @@ export interface PayloadMigration { updatedAt: string; createdAt: string; } - -declare module 'payload' { - export interface GeneratedTypes extends Config {} -} diff --git a/lib/shopify/payload.ts b/lib/shopify/payload.ts index 31c3b9c3f..73b764ed6 100644 --- a/lib/shopify/payload.ts +++ b/lib/shopify/payload.ts @@ -24,10 +24,11 @@ const OPERATORS = [ type Operator = (typeof OPERATORS)[number]; type WhereField = { + // eslint-disable-next-line no-unused-vars [key in Operator]?: unknown; }; export type Where = { - [key: string]: Where[] | WhereField; + [key: string]: Where[] | WhereField | undefined; and?: Where[]; or?: Where[]; }; @@ -58,24 +59,24 @@ type FindParams = { limit?: number; }; -export const find = (collection: string, params: FindParams) => { +export const find = (collection: Collection, params: FindParams) => { const query = qs.stringify(params, { addQueryPrefix: true }); const url = `${process.env.CMS_URL}/api/${collection}${query}`; return ajax>('GET', url); }; -export const findByID = (collection: string, id: string) => { +export const findByID = (collection: Collection, id: string) => { const url = `${process.env.CMS_URL}/api/${collection}/${id}`; return ajax('GET', url); }; -export const create = (collection: string, body: Partial) => { +export const create = (collection: Collection, body: Partial) => { const url = `${process.env.CMS_URL}/api/${collection}`; return ajax>('POST', url, body); }; -export const update = (collection: string, id: string, body: Partial) => { +export const update = (collection: Collection, id: string, body: Partial) => { const url = `${process.env.CMS_URL}/api/${collection}/${id}`; return ajax>('PATCH', url, body); }; diff --git a/lib/shopify/types.ts b/lib/shopify/types.ts index e78721510..23dc02d46 100644 --- a/lib/shopify/types.ts +++ b/lib/shopify/types.ts @@ -36,8 +36,8 @@ export type Collection = ShopifyCollection & { export type Image = { url: string; altText: string; - width?: number | null; - height?: number | null; + width: number; + height: number; }; export type Menu = {