Merge branch 'FE/LecutreEditPage' into 'frontend'
[Front-End] fix: LectureInfo 호출에 따른 불필요 state 제거 See merge request s11-webmobile1-sub2/S11P12A701!196
This commit is contained in:
commit
5555121f61
@ -24,14 +24,6 @@ export default function LectureLayout() {
|
||||
navigate('..');
|
||||
});
|
||||
};
|
||||
const lectureData = {
|
||||
title: lecture.title,
|
||||
description: lecture.description,
|
||||
plan: lecture.plan,
|
||||
startDate: lecture.startDate,
|
||||
endDate: lecture.endDate,
|
||||
time: lecture.time,
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (['NOT_ENROLLED', 'MANAGED_BY_OTHERS', 'PENDING'].includes(lecture.status)) {
|
||||
@ -67,12 +59,7 @@ export default function LectureLayout() {
|
||||
{userType === 'teacher' && (
|
||||
<SideBar title={'강의 정보 관리'}>
|
||||
<SideLink to={'teacherReportsets'}>퀴즈 성적 보기</SideLink>
|
||||
<SideLink
|
||||
to={'edit'}
|
||||
state={lectureData}
|
||||
>
|
||||
강의 정보 수정
|
||||
</SideLink>
|
||||
<SideLink to={'edit'}>강의 정보 수정</SideLink>
|
||||
<li>
|
||||
<span
|
||||
onClick={handleDelete}
|
||||
|
@ -1,13 +1,12 @@
|
||||
import { LectureForm } from '../../components/LectureForm';
|
||||
import { useLectureEdit } from '../../hooks/api/useLectureEdit';
|
||||
import { useParams, useNavigate, useLocation } from 'react-router-dom';
|
||||
import { useParams, useNavigate } from 'react-router-dom';
|
||||
import { useLectureInfo } from '../../hooks/api/useLectureInfo';
|
||||
|
||||
export default function LecutreEditPage() {
|
||||
const { lectureId } = useParams();
|
||||
const location = useLocation();
|
||||
const initialData = location.state.from;
|
||||
const lectureInfo = useLectureInfo(lectureId);
|
||||
const { data, refetch } = useLectureInfo(lectureId);
|
||||
const initialData = data.data;
|
||||
|
||||
const navigate = useNavigate();
|
||||
const { lectureEdit } = useLectureEdit();
|
||||
@ -15,7 +14,7 @@ export default function LecutreEditPage() {
|
||||
const handleSubmit = async (lectureObject) =>
|
||||
await lectureEdit(lectureId, lectureObject)
|
||||
.then(() => {
|
||||
lectureInfo.refetch();
|
||||
refetch();
|
||||
navigate('..');
|
||||
})
|
||||
.catch(() => {});
|
||||
|
Loading…
Reference in New Issue
Block a user