feat: DefaultStudentPage 추가
This commit is contained in:
parent
e3667f1b73
commit
3ef118ca0f
@ -47,8 +47,7 @@ export function useAuth() {
|
||||
const logout = () => {
|
||||
return instance
|
||||
.post(`${API_URL}/user/logout`)
|
||||
.then((response) => {
|
||||
console.log(response);
|
||||
.then(() => {
|
||||
setUserType(null);
|
||||
setToken(null);
|
||||
})
|
||||
|
24
frontend/src/pages/DefaultHomePage/DefaultHomePage.jsx
Normal file
24
frontend/src/pages/DefaultHomePage/DefaultHomePage.jsx
Normal file
@ -0,0 +1,24 @@
|
||||
import { ClassCard } from '../../components/ClassCard';
|
||||
import { ClassGrid } from '../../components/ClassGrid';
|
||||
import { MaxWidthLayout } from '../../components/Layout';
|
||||
import { useLectures } from '../../hooks/api/useLectures';
|
||||
|
||||
export default function StudentHomePage() {
|
||||
const { data: allLectures } = useLectures();
|
||||
const allClasses = allLectures?.data ?? [];
|
||||
|
||||
return (
|
||||
<MaxWidthLayout>
|
||||
<ClassGrid title="전체 강의">
|
||||
{allClasses.map?.((lecture) => (
|
||||
<ClassCard
|
||||
key={lecture.id}
|
||||
path={`/lecture/${lecture.id}/info`}
|
||||
>
|
||||
{lecture.title}
|
||||
</ClassCard>
|
||||
))}
|
||||
</ClassGrid>
|
||||
</MaxWidthLayout>
|
||||
);
|
||||
}
|
1
frontend/src/pages/DefaultHomePage/index.js
Normal file
1
frontend/src/pages/DefaultHomePage/index.js
Normal file
@ -0,0 +1 @@
|
||||
export { default } from './DefaultHomePage';
|
@ -1,16 +1,16 @@
|
||||
import useBoundStore from '../../store';
|
||||
import StudentHomePage from '../StudentHomePage/StudentHomePage';
|
||||
import TeacherHomePage from '../TeacherHomePage';
|
||||
import DefaultHomePage from '../DefaultHomePage';
|
||||
|
||||
export default function HomePage() {
|
||||
const userType = useBoundStore((state) => state.userType);
|
||||
// TODO: 비로그인 페이지 추가하기
|
||||
switch (userType) {
|
||||
case 'student':
|
||||
return <StudentHomePage />;
|
||||
case 'teacher':
|
||||
return <TeacherHomePage />;
|
||||
default:
|
||||
return <StudentHomePage />;
|
||||
return <DefaultHomePage />;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user