Skip to content

Commit

Permalink
Merge pull request #20 from ananjaemin/17-404오류-page-제작
Browse files Browse the repository at this point in the history
17 404오류 page 제작
  • Loading branch information
ananjaemin committed Nov 2, 2022
2 parents d79d21e + aac0261 commit 8e0e753
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 9 deletions.
11 changes: 10 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ import { ToastContainer } from 'react-toastify';

import 'react-toastify/dist/ReactToastify.css';
import { Navbar } from './components';
import { MainPage, SuccessPage, DownloadPage, DeletePage, FileListPage, ApiPage } from './pages';
import {
MainPage,
SuccessPage,
DownloadPage,
DeletePage,
FileListPage,
ApiPage,
NotFoundPage,
} from './pages';
import { store } from './state/store';

export const App: React.FC = () => (
Expand Down Expand Up @@ -42,6 +50,7 @@ export const App: React.FC = () => (
<Route path="/delete" element={<DeletePage />} />
<Route path="/filelist" element={<FileListPage />} />
<Route path="/api/*" element={<ApiPage />} />
<Route path="*" element={<NotFoundPage />} />
</Route>
</Routes>
</Provider>
Expand Down
17 changes: 10 additions & 7 deletions src/pages/api/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ export const ApiPage: React.FC = () => {
await axios({
method: 'get',
url: 'https://tfb.minpeter.cf/info',
}).then((res) => {
console.log(res.data);
setApiInfo(res.data);
setTimeout(() => {
setLoading(true); //loading 확인하고싶으면 false로 바꿔주세요.
}, 1200);
});
})
.then((res) => {
setApiInfo(res.data);
setTimeout(() => {
setLoading(true); //loading 확인하고싶으면 false로 바꿔주세요.
}, 1200);
})
.catch((err) => {
console.log(err);
});
};

useEffect(() => {
Expand Down
1 change: 1 addition & 0 deletions src/pages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export * from './download';
export * from './delete';
export * from './filelist';
export * from './api';
export * from './notfound';
5 changes: 5 additions & 0 deletions src/pages/notfound/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from 'react';

import * as S from './styled';

export const NotFoundPage: React.FC = () => <S.NotFoundPage>404</S.NotFoundPage>;
3 changes: 3 additions & 0 deletions src/pages/notfound/styled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import styled from '@emotion/styled';

export const NotFoundPage = styled.div``;
2 changes: 1 addition & 1 deletion src/pages/postApi/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const ApiPostPage: React.FC = () => {
})
.then((res) => {
if (res.data?.message === 'invalid api name') {
navigate('/'); //나중에 404페이지로 이동하게
navigate('/404'); //나중에 404페이지로 이동하게
} else {
setApiInfo(res.data);
setTimeout(() => {
Expand Down

0 comments on commit 8e0e753

Please sign in to comment.