brilliant-orangeB
Refine2y ago
12 replies
brilliant-orange

Patch will be processed after Put transmission.

export const EditProps = ({ items, id, point }: IEditPageProps) => {
const [itemsState, setItemsState] = useState(items)
const [pointState, setPointState] = useState(point)
const {
register,
handleSubmit,
refineCore: { onFinish },
} = useForm<TermValues, HttpError, TermValues>({
shouldUseNativeValidation: true,
refineCoreProps: {
resource: 'customergroups',
action: 'edit',
id: id,
},
})

const apiUrl = process.env.NEXT_PUBLIC_CAFE24_API_URL
const onSubmit = async () => {
const combinedState = { ...itemsState, ...pointState }
await axios.put(${apiUrl}/customergroups/${id}, combinedState).then((res) => res.data)
return onFinish(itemsState)
}
Was this page helpful?