mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
push now
This commit is contained in:
@@ -34,7 +34,7 @@ function FieldError({ message }) {
|
||||
export default function EditLesson() {
|
||||
const navigate = useNavigate();
|
||||
const { courseId, unitId, lessonId } = useParams();
|
||||
const { fetchLesson, updateLesson, course, unit, loading, fetchLessonRequirements, syncLessonRequirements } = useCourses();
|
||||
const { fetchLesson, updateLesson, fetchCourse, fetchUnit, course, unit, loading, fetchLessonRequirements, syncLessonRequirements } = useCourses();
|
||||
const { user } = useAuth();
|
||||
const [lessonTitle, setLessonTitle] = useState("");
|
||||
|
||||
@@ -60,6 +60,10 @@ export default function EditLesson() {
|
||||
objectives: lesson.objectives?.map((v) => ({ value: v.text })) ?? [],
|
||||
});
|
||||
})();
|
||||
fetchUnit(courseId, unitId);
|
||||
if (!course || String(course.course_id) !== String(courseId)) {
|
||||
fetchCourse(courseId);
|
||||
}
|
||||
}, [courseId, unitId, lessonId]);
|
||||
|
||||
const onSubmit = async (data) => {
|
||||
@@ -90,7 +94,11 @@ export default function EditLesson() {
|
||||
</Button>
|
||||
<div>
|
||||
<h1 className="text-xl font-semibold">Edit Lesson</h1>
|
||||
<p className="text-sm text-muted-foreground">Update lesson details.</p>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Lessons live in the shared Library — changes here apply everywhere this
|
||||
lesson is used, not just{unit ? ` "${unit.title}"` : " this unit"}
|
||||
{course ? ` (${course.title})` : ""}.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user