feat: move content to shopify

Signed-off-by: Chloe <pinkcloudvnn@gmail.com>
This commit is contained in:
Chloe
2024-06-05 14:48:31 +07:00
parent a356148ed3
commit 882d1db67c
20 changed files with 179 additions and 118 deletions

View File

@@ -562,13 +562,19 @@ export async function getMetaobjectsByIds(ids: string[]) {
return reshapeMetaobjects(res.body.data.nodes);
}
export async function getMetaobjectById(id: string) {
export async function getMetaobject({
id,
handle
}: {
id?: string;
handle?: { handle: string; type: string };
}) {
const res = await shopifyFetch<{
data: { metaobject: ShopifyMetaobject };
variables: { id: string };
variables: { id?: string; handle?: { handle: string; type: string } };
}>({
query: getMetaobjectQuery,
variables: { id }
variables: { id, handle }
});
return res.body.data.metaobject ? reshapeMetaobjects([res.body.data.metaobject])[0] : null;