question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG]If an error is returned from the RestAPI, the input is in progress.

See original GitHub issue

Sorry if this isn’t a bug.

Describe the bug https://refine.dev/docs/ui-frameworks/antd/tutorial/#editing-a-record When an error is returned from RestAPI (e.g. http status 422), the data being input is reset. Please provide a workaround for this.

This is a program I created.

import { useForm, Form, Input, Edit } from "@pankod/refine-antd";
import { HttpError, useTranslate } from "@pankod/refine-core";
import { IAdmin } from "interfaces/admin";

export const AdminEdit: React.FC = () => {
  const { formProps, saveButtonProps, queryResult } = useForm<
    IAdmin,
    HttpError
  >();

  const translate = useTranslate();

  return (
    <Edit saveButtonProps={saveButtonProps}>
      <Form {...formProps} layout="vertical">
        <Form.Item label={translate("admins.fields.name")} name="name">
          <Input />
        </Form.Item>
        <Form.Item label={translate("admins.fields.email")} name="email">
          <Input />
        </Form.Item>
        <Form.Item label={translate("admins.fields.password")} name="password">
          <Input />
        </Form.Item>
      </Form>
    </Edit>
  );
};

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
nrikijicommented, Apr 20, 2022

https://user-images.githubusercontent.com/4780752/164268836-fd83f71b-8898-4d71-b11c-e9597938abe9.mov

Procedure.

  1. Edit name
  2. Edit email
  3. Press “save” button
  4. RestAPI will return a status 422 error due to duplicate email address.
  5. Name and email will be restored to their original values.

I expect that the value will not be cleared in 5.

0reactions
nrikijicommented, Apr 20, 2022

@omeraplak It worked as expected. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

REST API issue/question: I am getting an error stating " JSON
Solved: Trying to run a RESST API command. When in the REST setup all is working correctly. However, once I set up to...
Read more >
REST API error code 500 handling - Stack Overflow
It is a server error, not a client error. If server errors weren't to be returned to the client, there wouldn't have been...
Read more >
Resolve API Gateway REST API 403 “Missing Authentication ...
API Gateway REST API endpoints return Missing Authentication Token errors for the following reasons: The API request is made to a method or ......
Read more >
REST API error codes - DocuSign Developers
Lists the error codes used by the eSignature REST API. ... The DocuSign REST APIs return either 200 (OK) or 201 (Created) when...
Read more >
Common REST API error codes - Azure Storage
Error code HTTP status code User message AccountAlreadyExists Conflict (409) The specified account already exists. AccountIsDisabled Forbidden (403) The specified account is disabled. AccountProtectedFromDeletion Conflict (409)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found