Skip to content

Commit c5160a0

Browse files
authored
Merge pull request #140 from ezcode-my/feat/not-found
Feat : not found
2 parents 97f6d80 + f116d2d commit c5160a0

3 files changed

Lines changed: 21 additions & 8 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { PATHS } from '@/constants/paths';
2+
import Link from 'next/link';
3+
4+
export default function NotFound() {
5+
return (
6+
<div className="w-full h-full flex justify-center items-center flex-col gap-5">
7+
<h1 className="text-2xl font-bold">
8+
문제가 삭제되었거나 문제 오류 발견으로 수정중인 문제 입니다.
9+
</h1>
10+
<Link href={PATHS.PROBLEMS} className="bg-primary p-5 rounded-lg text-white">
11+
문제 목록으로 돌아가기
12+
</Link>
13+
</div>
14+
);
15+
}

src/app/(auth)/(navigationsBarLayout)/problems/[problemId]/@tabs/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import Discussions from '@/features/discussions/disussions/ui/Discussions';
22
import { DetailProblem, getDetailProblem } from '@/entities/problem';
33
import CollapsibleProblem from '@/entities/problem/ui/CollapsibleProblem';
44
import { DiscussionsParamsProvider } from '@/features/discussions/disussions/model/Discussion.sort.context';
5+
import { notFound } from 'next/navigation';
56

67
interface IProblemPageProps {
78
params: Promise<{ problemId: string }>;
@@ -14,8 +15,7 @@ export default async function ProblemPage({ params, searchParams }: IProblemPage
1415
const detailProblem = await getDetailProblem(problemId);
1516

1617
if (!detailProblem) {
17-
console.error('문제를 불러오는 데 실패했습니다.');
18-
return <div>문제를 불러오는 데 실패했습니다.</div>;
18+
return notFound();
1919
}
2020

2121
return (

src/widgets/NavigationBar/ui/AuthActions.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ import { useLogoutMutation } from '@/entities/auth/model/mutation/auth.mutation'
1010

1111
import Notifications from './Notifications';
1212
import { useUserStore } from '@/entities/user/model/store';
13-
13+
import cookies from 'js-cookie';
1414
export default function AuthActions() {
1515
const router = useRouter();
1616
const { mutateAsync } = useLogoutMutation();
1717
const { user } = useUserStore((state) => state);
18+
const accessToken = cookies.get('accessToken');
1819

1920
const selectOption = (value: string) => {
2021
if (value === 'mypage') return router.push(PATHS.MYPAGE);
@@ -23,7 +24,7 @@ export default function AuthActions() {
2324

2425
return (
2526
<div className="flex items-center space-x-4">
26-
{user ? (
27+
{accessToken && user ? (
2728
<div className="flex flex-row gap-4 items-center">
2829
<Notifications />
2930
<Select
@@ -40,10 +41,7 @@ export default function AuthActions() {
4041
/>
4142
</div>
4243
) : (
43-
<>
44-
{/* <LinkedButton props={NAVIGATE_ATTRIBUTE.signup} /> */}
45-
<LinkedButton props={NAVIGATE_ATTRIBUTE.signin} />
46-
</>
44+
<LinkedButton props={NAVIGATE_ATTRIBUTE.signin} />
4745
)}
4846
</div>
4947
);

0 commit comments

Comments
 (0)