Skip to content

Commit

Permalink
리팩토링 전
Browse files Browse the repository at this point in the history
  • Loading branch information
castberry10 committed Aug 10, 2023
1 parent 14d34a7 commit 62c74f6
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 118 deletions.
5 changes: 2 additions & 3 deletions learn-redux-middleware/src/App.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import logo from './logo.svg';
import './App.css';
import CounterContainer from './containers/CounterContainer';
import SampleContainer from './containers/SampleContainer';

function App() {
return (
<div>
<CounterContainer></CounterContainer>
<SampleContainer></SampleContainer>
</div>
);
}
Expand Down
60 changes: 31 additions & 29 deletions learn-redux-middleware/src/components/Sample.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
const Sample = ({loadingPost, loadingUsers, post, users}) => {
return (
<div>
<section>
<h1>포스트</h1>
{loadingPost && '로딩 중...'}
{!loadingPost && post && (
<div>
<h3>{post.title}</h3>
<h3>{post.body}</h3>
</div>
)}
</section>
<hr/>
<section>
<h1>사용자 목록</h1>
{lodingUsers && '로딩 중...'}
{!lodingUsers && users && (
<ul>
{users.map(user => (
<li key = {user.id}>
{user.username} ({user.email})
</li>
))}
</ul>
)}
</section>
</div>
);
import React from 'react';

const Sample = ({ post, users, loadingPost, loadingUsers }) => {
return (
<div>
<section>
<h1>포스트</h1>
{loadingPost && '로딩중...'}
{!loadingPost && post && (
<div>
<h3>{post.title}</h3>
<h3>{post.body}</h3>
</div>
)}
</section>
<hr />
<section>
<h1>사용자 목록</h1>
{loadingUsers && '로딩중...'}
{!loadingUsers && users && (
<ul>
{users.map(user => (
<li key={user.id}>
{user.username} ({user.email})
</li>
))}
</ul>
)}
</section>
</div>
);
};

export default Sample;
4 changes: 2 additions & 2 deletions learn-redux-middleware/src/modules/sample.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {handleActions} from 'redux-actions';
import * as api from '../lib/api';

// import createRequestThunk from '../lib/createRequestThunk';
// 액션타입 선언
// 한요청당 세 개를 만들어야한다.

Expand Down Expand Up @@ -36,7 +36,7 @@ export const getPost = id => async dispatch => {
export const getUsers = () => async dispatch => {
dispatch({type: GET_USERS}); // 요청 시작을 알림
try{
const response = await api.getUsers(id);
const response = await api.getUsers();
dispatch({
type: GET_USERS_SUCCESS,
payload: response.data
Expand Down
Binary file removed news-viewer/public/favicon.ico
Binary file not shown.
43 changes: 0 additions & 43 deletions news-viewer/public/index.html

This file was deleted.

Binary file removed news-viewer/public/logo192.png
Binary file not shown.
Binary file removed news-viewer/public/logo512.png
Binary file not shown.
25 changes: 0 additions & 25 deletions news-viewer/public/manifest.json

This file was deleted.

3 changes: 0 additions & 3 deletions news-viewer/public/robots.txt

This file was deleted.

13 changes: 0 additions & 13 deletions news-viewer/src/index.css

This file was deleted.

0 comments on commit 62c74f6

Please sign in to comment.