fix type errors

This commit is contained in:
tedraykov 2024-07-08 19:02:24 +03:00
parent a9ad351786
commit 6262ec1c0b
2 changed files with 55 additions and 54 deletions

View File

@ -165,59 +165,59 @@ export const confirmOrder = async ({ order, content, formData }: ConfirmOrderOpt
} }
}; };
export async function returnCore(order: Order, formData: FormData) { export async function returnCore() {
const rawFormData = [ // const rawFormData = [
getMetafieldValue( // getMetafieldValue(
'coreReturnZip', // 'coreReturnZip',
{ // {
key: 'warranty_activation_odometer', // key: '',
value: formData.get('name') as string | null, // value: formData.get('name') as string | null,
type: 'file_reference' // type: 'file_reference'
}, // },
order // order
), // ),
getMetafieldValue( // getMetafieldValue(
'warrantyActivationInstallation', // 'warrantyActivationInstallation',
{ // {
key: 'warranty_activation_installation', // key: 'warranty_activation_installation',
value: installationFileId, // value: installationFileId,
type: 'file_reference' // type: 'file_reference'
}, // },
order // order
), // ),
getMetafieldValue( // getMetafieldValue(
'warrantyActivationSelfInstall', // 'warrantyActivationSelfInstall',
{ // {
key: 'warranty_activation_self_install', // key: 'warranty_activation_self_install',
value: formData.get('warranty_activation_self_install') === 'on' ? 'true' : 'false', // value: formData.get('warranty_activation_self_install') === 'on' ? 'true' : 'false',
type: 'boolean' // type: 'boolean'
}, // },
order // order
), // ),
getMetafieldValue( // getMetafieldValue(
'warrantyActivationMileage', // 'warrantyActivationMileage',
{ // {
key: 'warranty_activation_mileage', // key: 'warranty_activation_mileage',
value: formData.get('warranty_activation_mileage') as string | null, // value: formData.get('warranty_activation_mileage') as string | null,
type: 'number_integer' // type: 'number_integer'
}, // },
order // order
), // ),
getMetafieldValue( // getMetafieldValue(
'warrantyActivationVIN', // 'warrantyActivationVIN',
{ // {
key: 'warranty_activation_vin', // key: 'warranty_activation_vin',
value: formData.get('warranty_activation_vin') as string | null, // value: formData.get('warranty_activation_vin') as string | null,
type: 'single_line_text_field' // type: 'single_line_text_field'
}, // },
order // order
) // )
]; // ];
try { try {
await updateOrderMetafields({ // await updateOrderMetafields({
orderId: order.id, // orderId: order.id,
metafields: rawFormData // metafields: rawFormData
}); // });
revalidateTag(TAGS.orderMetafields); revalidateTag(TAGS.orderMetafields);
} catch (error) { } catch (error) {

View File

@ -3,7 +3,7 @@ import { Order } from 'lib/shopify/types';
import { Button, Heading, Input } from 'components/ui'; import { Button, Heading, Input } from 'components/ui';
import StatesCombobox from 'components/states-combobox'; import StatesCombobox from 'components/states-combobox';
import { useTransition } from 'react'; import { useTransition } from 'react';
import { returnCore } from './actions'; // import { returnCore } from './actions';
export function CoreReturnModal({ export function CoreReturnModal({
isOpen, isOpen,
@ -18,7 +18,8 @@ export function CoreReturnModal({
async function submitCoreReturn(formData: FormData) { async function submitCoreReturn(formData: FormData) {
startTransition(async () => { startTransition(async () => {
returnCore(order, formData); // returnCore(order, formData);
console.log(formData);
}); });
} }