From 6262ec1c0b293d90a7383420f81a85e52446ed3f Mon Sep 17 00:00:00 2001 From: tedraykov Date: Mon, 8 Jul 2024 19:02:24 +0300 Subject: [PATCH] fix type errors --- components/orders/actions.tsx | 104 ++++++++++++------------ components/orders/core-return-modal.tsx | 5 +- 2 files changed, 55 insertions(+), 54 deletions(-) diff --git a/components/orders/actions.tsx b/components/orders/actions.tsx index 928a9e345..a7773bcf1 100644 --- a/components/orders/actions.tsx +++ b/components/orders/actions.tsx @@ -165,59 +165,59 @@ export const confirmOrder = async ({ order, content, formData }: ConfirmOrderOpt } }; -export async function returnCore(order: Order, formData: FormData) { - const rawFormData = [ - getMetafieldValue( - 'coreReturnZip', - { - key: 'warranty_activation_odometer', - value: formData.get('name') as string | null, - type: 'file_reference' - }, - order - ), - getMetafieldValue( - 'warrantyActivationInstallation', - { - key: 'warranty_activation_installation', - value: installationFileId, - type: 'file_reference' - }, - order - ), - getMetafieldValue( - 'warrantyActivationSelfInstall', - { - key: 'warranty_activation_self_install', - value: formData.get('warranty_activation_self_install') === 'on' ? 'true' : 'false', - type: 'boolean' - }, - order - ), - getMetafieldValue( - 'warrantyActivationMileage', - { - key: 'warranty_activation_mileage', - value: formData.get('warranty_activation_mileage') as string | null, - type: 'number_integer' - }, - order - ), - getMetafieldValue( - 'warrantyActivationVIN', - { - key: 'warranty_activation_vin', - value: formData.get('warranty_activation_vin') as string | null, - type: 'single_line_text_field' - }, - order - ) - ]; +export async function returnCore() { + // const rawFormData = [ + // getMetafieldValue( + // 'coreReturnZip', + // { + // key: '', + // value: formData.get('name') as string | null, + // type: 'file_reference' + // }, + // order + // ), + // getMetafieldValue( + // 'warrantyActivationInstallation', + // { + // key: 'warranty_activation_installation', + // value: installationFileId, + // type: 'file_reference' + // }, + // order + // ), + // getMetafieldValue( + // 'warrantyActivationSelfInstall', + // { + // key: 'warranty_activation_self_install', + // value: formData.get('warranty_activation_self_install') === 'on' ? 'true' : 'false', + // type: 'boolean' + // }, + // order + // ), + // getMetafieldValue( + // 'warrantyActivationMileage', + // { + // key: 'warranty_activation_mileage', + // value: formData.get('warranty_activation_mileage') as string | null, + // type: 'number_integer' + // }, + // order + // ), + // getMetafieldValue( + // 'warrantyActivationVIN', + // { + // key: 'warranty_activation_vin', + // value: formData.get('warranty_activation_vin') as string | null, + // type: 'single_line_text_field' + // }, + // order + // ) + // ]; try { - await updateOrderMetafields({ - orderId: order.id, - metafields: rawFormData - }); + // await updateOrderMetafields({ + // orderId: order.id, + // metafields: rawFormData + // }); revalidateTag(TAGS.orderMetafields); } catch (error) { diff --git a/components/orders/core-return-modal.tsx b/components/orders/core-return-modal.tsx index 56321ab0a..c65aa1176 100644 --- a/components/orders/core-return-modal.tsx +++ b/components/orders/core-return-modal.tsx @@ -3,7 +3,7 @@ import { Order } from 'lib/shopify/types'; import { Button, Heading, Input } from 'components/ui'; import StatesCombobox from 'components/states-combobox'; import { useTransition } from 'react'; -import { returnCore } from './actions'; +// import { returnCore } from './actions'; export function CoreReturnModal({ isOpen, @@ -18,7 +18,8 @@ export function CoreReturnModal({ async function submitCoreReturn(formData: FormData) { startTransition(async () => { - returnCore(order, formData); + // returnCore(order, formData); + console.log(formData); }); }