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;

View File

@@ -20,8 +20,8 @@ export const getMetaobjectsQuery = /* GraphQL */ `
`;
export const getMetaobjectQuery = /* GraphQL */ `
query getMetaobject($id: ID!) {
metaobject(id: $id) {
query getMetaobject($id: ID, $handle: MetaobjectHandleInput) {
metaobject(id: $id, handle: $handle) {
id
type
fields {

View File

@@ -4,6 +4,8 @@ export const colors = {
secondary: '#EF6C02',
blue: {
800: '#1C1F35',
200: '#666C89'
200: '#666C89',
500: '#2D3A7B',
600: '#111C55'
}
};