fix: 리포트 상세페이지 뒤로가기 학생 / 교사 별도 적용

This commit is contained in:
정기영 2024-08-12 13:25:41 +09:00
parent ae2c2891bb
commit 603b8d8014

View File

@ -3,6 +3,7 @@ import styles from './StudentReportDetailPage.module.css';
import BackIcon from '/src/assets/icons/back.svg?react'; import BackIcon from '/src/assets/icons/back.svg?react';
import { useStudentReportDetail } from '../../hooks/api/useStudentReportDetail'; import { useStudentReportDetail } from '../../hooks/api/useStudentReportDetail';
import { QuizDetailCard } from '../../components/QuizForm'; import { QuizDetailCard } from '../../components/QuizForm';
import useBoundStore from '../../store';
export default function StudentReportDetailPage() { export default function StudentReportDetailPage() {
const { lectureId, reportId } = useParams(); const { lectureId, reportId } = useParams();
@ -10,11 +11,18 @@ export default function StudentReportDetailPage() {
const report = data.data; const report = data.data;
const { allCount, correctCount, quizzes, title } = report; const { allCount, correctCount, quizzes, title } = report;
const score = Math.round((100 * correctCount) / allCount); const score = Math.round((100 * correctCount) / allCount);
const userType = useBoundStore((state) => state.userType);
console.log(userType);
return ( return (
<div className={styles.wrapper}> <div className={styles.wrapper}>
<header className={styles.header}> <header className={styles.header}>
<Link <Link
to={`/lecture/${lectureId}/class/teacherReportsets`} to={
userType === 'student'
? `/lecture/${lectureId}/class/report`
: `/lecture/${lectureId}/class/teacherReportsets`
}
className={styles.goBack} className={styles.goBack}
> >
<BackIcon /> <BackIcon />