then-purpleT
Refine3y ago
4 replies
then-purple

Get return value from Edit page

<Edit saveButtonProps={saveButtonProps} >
      <Form {...formProps} layout="vertical" onFinish={handleOnFinish}>
        <Form.Item label="Avatar">
          <Form.Item
            name="avatar"
            valuePropName="file"
            getValueFromEvent={getValueFromEvent}
            noStyle
            rules={[
              {
                required: true,
              },
            ]}

          >
            <Upload
              name="file"
              listType="picture-circle"
              className="avatar-uploader"
              showUploadList={false}
              action={`${apiUrl}/admin/upload`}
              beforeUpload={beforeUpload}
              onChange={handleChange}
              headers={{
                Authorization: `${localStorage.getItem(TOKEN_TYPE)} ${localStorage.getItem(TOKEN_KEY)}`,
              }}
            >
              {imageUrl ? <Avatar src={imageUrl} alt="avatar" style={{ height: '100%', width: 'auto', borderRadius: "100%" }} /> : uploadButton}
            </Upload>
          </Form.Item>
        </Form.Item>
      
      </Form>
    </Edit >

I want to get avatar value from Edit page and parse into the Avatar component
Was this page helpful?