fix: 강사가 라이브 방 만들 수 있도록 수정

This commit is contained in:
jhynsoo 2024-08-12 09:42:17 +09:00
parent 6e36781702
commit 5d981aa2a5
2 changed files with 4 additions and 4 deletions

View File

@ -3,9 +3,12 @@ import styles from './LectureHeader.module.css';
import PlayIcon from '/src/assets/icons/play.svg?react'; import PlayIcon from '/src/assets/icons/play.svg?react';
import CompassIcon from '/src/assets/icons/compass.svg?react'; import CompassIcon from '/src/assets/icons/compass.svg?react';
import UserIcon from '/src/assets/icons/user.svg?react'; import UserIcon from '/src/assets/icons/user.svg?react';
import useBoundStore from '../../store';
export default function LectureHeader({ img, title, tutorImg, tutor, isLive = false }) { export default function LectureHeader({ img, title, tutorImg, tutor, isLive = false }) {
const { lectureId } = useParams(); const { lectureId } = useParams();
const userType = useBoundStore((state) => state.userType);
const isTeacher = userType === 'teacher';
return ( return (
<div className={styles.wrapper}> <div className={styles.wrapper}>
@ -39,7 +42,7 @@ export default function LectureHeader({ img, title, tutorImg, tutor, isLive = fa
<div>{tutor}</div> <div>{tutor}</div>
</div> </div>
<div> <div>
{isLive ? ( {isLive || isTeacher ? (
<Link <Link
to={`/live/${lectureId}`} to={`/live/${lectureId}`}
target="_blank" target="_blank"

View File

@ -1,7 +1,4 @@
export const userTypeSlice = (set) => ({ export const userTypeSlice = (set) => ({
userType: null, userType: null,
setUserType: (userType) => set({ userType }), setUserType: (userType) => set({ userType }),
isTeacher: () => set.userType === 'teacher',
isStudent: () => set.userType === 'student',
isGuest: () => set.userType === null,
}); });