mirror of
https://github.com/vercel/commerce.git
synced 2025-06-07 00:36:59 +00:00
cache meatobject requests
Signed-off-by: Chloe <pinkcloudvnn@gmail.com>
This commit is contained in:
parent
5ef8470526
commit
b8f6bc24d2
@ -205,12 +205,14 @@ async function shopifyAdminFetch<T>({
|
|||||||
headers,
|
headers,
|
||||||
query,
|
query,
|
||||||
variables,
|
variables,
|
||||||
tags
|
tags,
|
||||||
|
cache = 'no-store'
|
||||||
}: {
|
}: {
|
||||||
headers?: HeadersInit;
|
headers?: HeadersInit;
|
||||||
query: string;
|
query: string;
|
||||||
variables?: ExtractVariables<T>;
|
variables?: ExtractVariables<T>;
|
||||||
tags?: string[];
|
tags?: string[];
|
||||||
|
cache?: RequestCache;
|
||||||
}): Promise<{ status: number; body: T } | never> {
|
}): Promise<{ status: number; body: T } | never> {
|
||||||
try {
|
try {
|
||||||
const result = await fetch(adminEndpoint, {
|
const result = await fetch(adminEndpoint, {
|
||||||
@ -225,7 +227,7 @@ async function shopifyAdminFetch<T>({
|
|||||||
...(variables && { variables })
|
...(variables && { variables })
|
||||||
}),
|
}),
|
||||||
...(tags && { next: { tags } }),
|
...(tags && { next: { tags } }),
|
||||||
cache: 'no-store'
|
cache
|
||||||
});
|
});
|
||||||
|
|
||||||
const body = await result.json();
|
const body = await result.json();
|
||||||
@ -939,7 +941,8 @@ export async function getMetaobjectReferences(
|
|||||||
data: { metaobject: ShopifyMetaobject };
|
data: { metaobject: ShopifyMetaobject };
|
||||||
}>({
|
}>({
|
||||||
query: getMetaobjectReferencesQuery,
|
query: getMetaobjectReferencesQuery,
|
||||||
variables: { id, after }
|
variables: { id, after },
|
||||||
|
cache: 'force-cache'
|
||||||
});
|
});
|
||||||
|
|
||||||
const metaobject = res.body.data.metaobject;
|
const metaobject = res.body.data.metaobject;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user