cache meatobject requests

Signed-off-by: Chloe <pinkcloudvnn@gmail.com>
This commit is contained in:
Chloe 2024-07-09 12:04:28 +07:00
parent 5ef8470526
commit b8f6bc24d2
No known key found for this signature in database
GPG Key ID: CFD53CE570D42DF5

View File

@ -205,12 +205,14 @@ async function shopifyAdminFetch<T>({
headers,
query,
variables,
tags
tags,
cache = 'no-store'
}: {
headers?: HeadersInit;
query: string;
variables?: ExtractVariables<T>;
tags?: string[];
cache?: RequestCache;
}): Promise<{ status: number; body: T } | never> {
try {
const result = await fetch(adminEndpoint, {
@ -225,7 +227,7 @@ async function shopifyAdminFetch<T>({
...(variables && { variables })
}),
...(tags && { next: { tags } }),
cache: 'no-store'
cache
});
const body = await result.json();
@ -939,7 +941,8 @@ export async function getMetaobjectReferences(
data: { metaobject: ShopifyMetaobject };
}>({
query: getMetaobjectReferencesQuery,
variables: { id, after }
variables: { id, after },
cache: 'force-cache'
});
const metaobject = res.body.data.metaobject;