Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat]: 관리자 페이지, 관리자 상세 페이지, 공고 작성 페이지 #63

Merged
merged 18 commits into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"msw": "^2.0.1",
"prettier": "3.0.3",
"tailwindcss": "^3.3.3"
}
Expand Down
5 changes: 5 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import ReactDOM from 'react-dom/client';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import App from './App';
import reportWebVitals from './reportWebVitals';
/* eslint import/newline-after-import: "off" */
import worker from './mocks/worker';
if (process.env.NODE_ENV === 'development') {
worker.start();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MSW를 사용하기 위한 구문인가 보네요! 제가 사용하게 된다면 아마 별도로 .env 파일에 REACT_APP__NODE_ENV = "development"를 넣어줘야 하겠네요!!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저 이거 할 때 .env 파일 따로 안건드렸어요! 별도로 효원님께서 설정해주셔야 되는 건 설치말고는 없을 거에요!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아하!!! 알겠습니다😄😄👍


const queryClient = new QueryClient();
const root = ReactDOM.createRoot(document.getElementById('root'));
Expand Down
10 changes: 10 additions & 0 deletions src/mocks/handlers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { http, HttpResponse } from 'msw';
import REQUEST_LIST from './mockData';

const handlers = [
http.get('/admin', () => {
return HttpResponse.json(REQUEST_LIST);
}),
];

export default handlers;
26 changes: 26 additions & 0 deletions src/mocks/mockData.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const REQUEST_LIST = {
success: true,
response: {
user: [
{
user_id: 1,
nickname: '홍길동',
},
{
user_id: 2,
nickname: '홍길동',
},
{
user_id: 3,
nickname: '홍길동',
},
{
user_id: 4,
nickname: '홍길동',
},
],
},
error: null,
};

export default REQUEST_LIST;
5 changes: 5 additions & 0 deletions src/mocks/worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { setupWorker } from 'msw/browser';
import handlers from './handlers';

const worker = setupWorker(...handlers);
export default worker;