import { useQuery } from '@tanstack/react-query'; import { Form, Formik } from 'formik'; import { toast } from 'react-toastify'; import { FormControl, FormLabel, Radio, RadioGroup, FormControlLabel, Button, Box, Grid, } from '@mui/material'; import { ShippingService } from '../../features/shipping/shipping-service'; import { Layout } from '../../layout/Layout'; import { LoadingButton } from '@mui/lab'; export const ModeEdit = () => { const { data, isFetching } = useQuery({ queryKey: ['mode'], queryFn: ShippingService.getMode, initialData: '', }); const parent = { label: 'Shipping', to: '..' }; return ( ShippingService.update(values.mode).then((mode) => toast.info( `Shipping mode updated to ${mode.replace( '_', ' ' )}.`, { icon: false, } ) ) } > {({ values, setFieldValue, isSubmitting }) => (
Shipping mode { setFieldValue( 'mode', event.currentTarget.value ); }} > } label="Free" /> } label="Rate" /> } label="Parcel" /> Update
)}
); };