Skip to content

Commit 98c07ef

Browse files
committed
코드 수정
1 parent 69ff32c commit 98c07ef

File tree

9 files changed

+43
-32
lines changed

9 files changed

+43
-32
lines changed

20230325/express/src/services/ProductService.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,6 @@ export default class ProductService {
171171
}));
172172
product.description = productDto.description;
173173
product.hidden = !!product.hidden;
174-
175-
data.products.push(product);
176174
}
177175
}
178176

20230423/react/src/components/Header.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,19 @@ import useAccessToken from '../hooks/useAccessToken';
99
import { apiService } from '../services/ApiService';
1010

1111
const Container = styled.header`
12-
margin-bottom: 2rem;
12+
margin-bottom: 1rem;
1313
1414
h1 {
15-
font-size: 4rem;
15+
font-size: 3rem;
1616
}
1717
18-
nav {
19-
padding-block: 2rem;
20-
21-
ul {
22-
display: flex;
23-
}
18+
ul {
19+
display: flex;
2420
2521
li {
26-
margin-right: 2rem;
22+
height: 4rem;
23+
line-height: 4rem;
24+
margin-right: 1rem;
2725
}
2826
}
2927
`;

20230423/react/src/constants.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
/* eslint-disable import/prefer-default-export */
2-
31
export const STATUS_MESSAGES: Record<string, string> = {
42
paid: '결제 완료',
53
ready: '배송 준비',
64
shipping: '배송 중',
75
complete: '배송 완료',
86
canceled: '취소',
97
};
8+
9+
// TODO: delete this!
10+
export default {};

20230423/react/src/hooks/useFetchCategories.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ import { apiService } from '../services/ApiService';
55
import { Category } from '../types';
66

77
export default function useFetchCategories() {
8+
type Data = {
9+
categories: Category[];
10+
};
11+
812
const {
913
data, error, loading, mutate,
10-
} = useFetch<{
11-
categories: Category[];
12-
}>('/categories');
14+
} = useFetch<Data>('/categories');
1315

1416
return {
1517
categories: data?.categories ?? [],

20230423/react/src/hooks/useFetchUsers.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import useFetch from './useFetch';
33
import { User } from '../types';
44

55
export default function useFetchUsers() {
6-
const { data, error, loading } = useFetch<{
6+
type Data = {
77
users: User[];
8-
}>('/users');
8+
};
9+
10+
const { data, error, loading } = useFetch<Data>('/users');
911

1012
return {
1113
users: data?.users ?? [],

20230423/react/src/pages/OrderDetailPage.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const Container = styled.div`
4747
}
4848
`;
4949

50-
export default function OrderEditPage() {
50+
export default function OrderDetailPage() {
5151
const params = useParams();
5252

5353
const { order, loading, error } = useFetchOrder({
@@ -129,9 +129,17 @@ export default function OrderEditPage() {
129129
<dt>상태</dt>
130130
<dd>{STATUS_MESSAGES[order.status]}</dd>
131131
</dl>
132-
<Link to={`/orders/${order.id}/edit`}>
133-
상태 변경
134-
</Link>
132+
<p>
133+
<Link to={`/orders/${order.id}/edit`}>
134+
상태 변경
135+
</Link>
136+
{' '}
137+
|
138+
{' '}
139+
<Link to="/orders">
140+
주문 목록
141+
</Link>
142+
</p>
135143
</Container>
136144
);
137145
}

20230423/react/src/pages/OrderListPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default function OrderListPage() {
5858

5959
return (
6060
<Container>
61-
<h2>Products</h2>
61+
<h2>Orders</h2>
6262
<table>
6363
<thead>
6464
<tr>

20230423/react/src/routes.test.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,16 @@ describe('routes', () => {
166166
});
167167
});
168168

169-
// context('when the current path is “/products/{id}/edit', () => {
170-
// const [product] = fixtures.products;
169+
context('when the current path is “/products/{id}/edit', () => {
170+
const [product] = fixtures.products;
171171

172-
// it('renders the edit product page', async () => {
173-
// renderRouter(`/products/${product.id}/edit`);
172+
it('renders the edit product page', async () => {
173+
renderRouter(`/products/${product.id}/edit`);
174174

175-
// await waitFor(() => {
176-
// screen.getByDisplayValue(product.name);
177-
// });
178-
// });
179-
// });
175+
await waitFor(() => {
176+
screen.getByDisplayValue(product.name);
177+
});
178+
});
179+
});
180180
});
181181
});

20230423/react/src/stores/ProductFormStore.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ describe('ProductFormStore', () => {
4545
beforeEach(() => {
4646
store.reset();
4747

48+
expect(store.valid).toBeFalsy();
49+
4850
store.changeCategory(category);
4951
store.changeName('New Product');
5052
store.changePrice('123400');

0 commit comments

Comments
 (0)