brilliant-orangeB
Refine3y ago
3 replies
brilliant-orange

Can't I use edit without entering id in useForm?

export const EditFirstEventProps = ({items}: {items:FirstEventValues }) => {
  const [itemsState, setItemsState] = useState<FirstEventValues>(items);
  const {
    handleSubmit,
    refineCore: {onFinish},
  } = useForm<HttpError>({
    shouldUseNativeValidation: true,
    refineCoreProps: {
      resource: "firstevent",
      action: "edit",
    },

  });


[useForm]: action: "edit", resource: "firstevent", id: undefined

If you don't use the setId method to set the
id
, you should pass the
id
prop to useForm. Otherwise, useForm will not be able to infer the
id
from the current URL.

___
const firstEventResponse = await fetch(http://localhost:4000/firstevent);
const firstEvent = await firstEventResponse.json();

"first event": { "id": 1, "event term": 1111, "event check": "N" },
We are receiving this type of data.

I don't want it to be http://localhost:4000/firstevent/1.

How to save data without using id?
Was this page helpful?