Невозможно выполнить запрос axios PUT в Django REST + фреймворк React - Запрос не выполнен с кодом состояния 400

Когда я пытаюсь обновить данные в моей базе данных Django SQLite через reactJS, он выдает такую ошибку, но в последний день все работает нормально

хотя я не изменил здесь никакого кода, теперь он работает и показывает ошибку, о которой я говорил ниже

PUT http://127.0.0.1:8000/employee/1 400 (Bad Request)

AxiosError {message: 'Request failed with status code 400', name: 'AxiosError', code: 'ERR_BAD_REQUEST', config: {…}, request: XMLHttpRequest, …}

// Update Employee
    const updateEmployee = (id) => {
        Axios.put("http://127.0.0.1:8000/employee/"+id, {
            name: name,
            age: age,
            email: email,
            designation: designation
        });
        console.log(Axios.put);
        Swal.fire("Updated!", "", "success");
        // window.location.reload();
    };
return(
        <>
            <h1 className="text-left text-danger">Update Employee</h1>
            <div className="container">
                <div className="row">
                    <div className="col-md-12">
                        <div className="form-group">
                            <label>Name</label>
                            <input type="text" className="form-control" placeholder="Enter Name" defaultValue={data.name} onChange={(e) => setName(e.target.value)} />
                        </div>
                        <div className="form-group">
                            <label>Age</label>
                            <input type="text" className="form-control" placeholder="Enter Age" defaultValue={data.age} onChange={(e) => setAge(e.target.value)} />
                        </div>
                        <div className="form-group">
                            <label>Email</label>
                            <input type="text" className="form-control" placeholder="Enter Email" defaultValue={data.email} onChange={(e) => setEmail(e.target.value)} />
                        </div>
                        <div className="form-group">
                            <label>Designation</label>
                            <input type="text" className="form-control" placeholder="Enter Designation" defaultValue={data.designation} onChange={(e) => setDesignation(e.target.value)} />
                        </div>
                        <div className="mt-2">
                        <button className="btn btn-primary" onClick={() => updateEmployee(data.id)}>Update</button>
                        <Link className="btn btn-danger mx-2" to="/">Cancel</Link>
                        </div>
                    </div>
                </div>
            </div>
        </>
    )
Вернуться на верх