ManageCoursePage - handleChange function
parent
31834fdb59
commit
f6970c99ee
|
@ -25,7 +25,22 @@ function ManageCoursePage({ courses, authors, actions, ...props }) {
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return <CourseForm course={course} errors={errors} authors={authors} />;
|
function handleChange(event) {
|
||||||
|
const { name, value } = event.target;
|
||||||
|
setCourse((prevCourse) => ({
|
||||||
|
...prevCourse,
|
||||||
|
[name]: name === "authorId" ? parseInt(value, 10) : value
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<CourseForm
|
||||||
|
course={course}
|
||||||
|
errors={errors}
|
||||||
|
authors={authors}
|
||||||
|
onChange={handleChange}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ManageCoursePage.propTypes = {
|
ManageCoursePage.propTypes = {
|
||||||
|
|
Loading…
Reference in New Issue