recent-tealR
Refine3y ago
6 replies
recent-teal

How to convert Form data before requesting

I used antd.
I have a multi choice field on the create page.
<Form.Item name={['user', 'id']} label="user" required>
          <Select {...userProps} mode="multiple" />
</Form.Item>

The original data is like this.
{
  user: [1, 2, 3]
}

I want to change it to this.
{
  user: [
    {
      id: 1,
    },
    {
      id: 2,
    },
    ...
  ]
}

What needs to be done?
Was this page helpful?