Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"next": "15.5.9",
"react": "19.1.0",
"react-dom": "19.1.0",
"react-hot-toast": "^2.6.0",
"zustand": "^5.0.9"
},
"devDependencies": {
Expand Down
5 changes: 3 additions & 2 deletions src/lib/services/servicesClient.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import axios, { AxiosError, AxiosResponse } from 'axios';
import toast from 'react-hot-toast';

import useAuthStore from '@/stores/useAuthStore';
import { ErrorResponse } from '@/types/api/apiError';
Expand All @@ -19,10 +20,10 @@ const onError = (error: AxiosError<ErrorResponse>): Promise<ErrorResponse> => {
const res = error.response;

if (res?.data) {
// 추후에 에러 처리 작업 진행 예정
toast.error(res.data.message ?? '잠시후에 다시 시도해주세요');
return Promise.reject(error);
}

toast.error('서버 장애 : 잠시후에 다시 시도해주세요');
return Promise.reject(error);
};

Expand Down
46 changes: 46 additions & 0 deletions src/pages/404.page.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import styled from '@emotion/styled';

import { colors } from '@/styles/colors';

export const Container = styled.section`
display: flex;
flex-direction: column;
gap: 16px;
align-items: center;
justify-content: center;
width: 100%;
min-height: calc(100vh - 80px);
padding: 40px 20px;
text-align: center;
`;

export const Title = styled.h1`
margin: 0;
font-size: 72px;
`;

export const Subtitle = styled.h2`
font-size: 24px;
`;

export const Description = styled.p`
margin-bottom: 20px;
font-size: 16px;
`;

export const HomeButton = styled.button`
padding: 12px 20px;
font-size: 16px;
font-weight: 700;
color: ${colors.white};
cursor: pointer;
background-color: #ea3c12;
border: none;
border-radius: 8px;
transition: 0.2s;

&:hover {
opacity: 0.9;
transform: translateY(-2px);
}
`;
29 changes: 29 additions & 0 deletions src/pages/404.page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { useRouter } from 'next/router';

import { STORE_ROUTES } from '@/constants/routes';

import * as S from './404.page.style';

const NotFoundPage = () => {
const router = useRouter();

const handleGoHome = () => {
router.replace(STORE_ROUTES.ROOT);
};

return (
<S.Container>
<S.Title>404</S.Title>
<S.Subtitle>페이지를 찾을 수 없습니다</S.Subtitle>
<S.Description>
입력하신 주소가 잘못되었거나
<br /> 페이지가 이동되었을 수 있어요.
</S.Description>
<S.HomeButton type="button" onClick={handleGoHome}>
홈으로 돌아가기
</S.HomeButton>
</S.Container>
);
};

export default NotFoundPage;
2 changes: 2 additions & 0 deletions src/pages/_app.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { AppProps } from 'next/app';

import { NextPage } from 'next';
import { ReactElement, ReactNode } from 'react';
import { Toaster } from 'react-hot-toast';

import DefaultLayout from '@/components/layout/DefaultLayout';
import { GlobalStyle } from '@/styles/GlobalStyle';
Expand All @@ -22,6 +23,7 @@ const App = ({ Component, pageProps }: AppPropsWithLayout) => {
<>
<GlobalStyle />
<Component {...pageProps} />
<Toaster />
</>
);
};
Expand Down
Loading