Skip to content

Commit

Permalink
Feat:중간저장
Browse files Browse the repository at this point in the history
  • Loading branch information
LeHiHo committed Oct 20, 2023
2 parents df5e459 + e02db55 commit 08f8a1d
Show file tree
Hide file tree
Showing 14 changed files with 413 additions and 67 deletions.
18 changes: 18 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"configurations": [
{
"name": "macos-clang-arm64",
"includePath": [
"${workspaceFolder}/**"
],
"compilerPath": "/usr/bin/clang",
"cStandard": "${default}",
"cppStandard": "${default}",
"intelliSenseMode": "macos-clang-arm64",
"compilerArgs": [
""
]
}
],
"version": 4
}
13 changes: 13 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "C/C++ Runner: Debug Session",
"type": "lldb",
"request": "launch",
"args": [],
"cwd": "/Users/hojin/dev/marketclone/src/app/product",
"program": "/Users/hojin/dev/marketclone/src/app/product/build/Debug/outDebug"
}
]
}
59 changes: 59 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"C_Cpp_Runner.cCompilerPath": "clang",
"C_Cpp_Runner.cppCompilerPath": "clang++",
"C_Cpp_Runner.debuggerPath": "lldb",
"C_Cpp_Runner.cStandard": "",
"C_Cpp_Runner.cppStandard": "",
"C_Cpp_Runner.msvcBatchPath": "",
"C_Cpp_Runner.useMsvc": false,
"C_Cpp_Runner.warnings": [
"-Wall",
"-Wextra",
"-Wpedantic",
"-Wshadow",
"-Wformat=2",
"-Wcast-align",
"-Wconversion",
"-Wsign-conversion",
"-Wnull-dereference"
],
"C_Cpp_Runner.msvcWarnings": [
"/W4",
"/permissive-",
"/w14242",
"/w14287",
"/w14296",
"/w14311",
"/w14826",
"/w44062",
"/w44242",
"/w14905",
"/w14906",
"/w14263",
"/w44265",
"/w14928"
],
"C_Cpp_Runner.enableWarnings": true,
"C_Cpp_Runner.warningsAsError": false,
"C_Cpp_Runner.compilerArgs": [],
"C_Cpp_Runner.linkerArgs": [],
"C_Cpp_Runner.includePaths": [],
"C_Cpp_Runner.includeSearch": [
"*",
"**/*"
],
"C_Cpp_Runner.excludeSearch": [
"**/build",
"**/build/**",
"**/.*",
"**/.*/**",
"**/.vscode",
"**/.vscode/**"
],
"C_Cpp_Runner.useAddressSanitizer": false,
"C_Cpp_Runner.useUndefinedSanitizer": false,
"C_Cpp_Runner.useLeakSanitizer": false,
"C_Cpp_Runner.showCompilationTime": false,
"C_Cpp_Runner.useLinkTimeOptimization": false,
"C_Cpp_Runner.msvcSecureNoWarnings": false
}
30 changes: 18 additions & 12 deletions src/api/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ export const postProducts = async (
title: string,
categoryName: string,
content: string,
price: number,
price: string,
images?: FileList | null,
) => {
const formData = new FormData();
formData.append('title', title);
formData.append('categoryName', categoryName);
formData.append('content', content);
formData.append('price', price.toString());
formData.append('price', price);

// 여러 이미지를 처리하는 경우
if (images) {
Expand All @@ -45,6 +45,18 @@ export const postProducts = async (
return res;
};

// 상품삭제
export const deleteProducts = async (id: number) => {
const res = await client.delete(`products/${id}`);
return res;
};

// 상품수정
export const putProducts = async (id: number) => {
const res = await client.put(`products/${id}`);
return res;
};

export const getProductCategory = async () => {
const res = await client.get(`/products/categories`);
return res.data;
Expand All @@ -56,21 +68,15 @@ export const getProducts = async (searchWord?: string, category?: string) => {
params: {
searchWord,
categoryNames: category,
pageSize: 300, // 추후 수정 예정입니다.
},
});
return res.data;
};

// 상품수정
export const putProducts = async (id: number) => {
const res = await client.put(`products/${id}`);
return res;
};

// 상품삭제
export const deleteProducts = async (id: number) => {
const res = await client.delete(`products/${id}`);
return res;
export const getUserProducts = async (id: string) => {
const res = await client.get(`/products/${id}/list`);
return res.data;
};

export const postSignUp = async (
Expand Down
2 changes: 1 addition & 1 deletion src/app/main/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import MainPage from '@/templates/main/mainPage';

export default async function Main() {
export default function Main() {
return (
<>
<MainPage />
Expand Down
9 changes: 9 additions & 0 deletions src/app/product/[id]/edit/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import ProductPut from '@/templates/product/productPut';

export default function Page() {
return (
<>
<ProductPut />
</>
);
}
9 changes: 9 additions & 0 deletions src/app/product/products/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import ProductShowAll from '@/templates/product/productShowAll';

export default function Page() {
return (
<>
<ProductShowAll />
</>
);
}
7 changes: 4 additions & 3 deletions src/components/productItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ export default function ProductItem({ product }: { product: IProduct }) {
const onClick = () => {
router.push(`/product/${[product.id]}`);
};

return (
<li className="product" onClick={onClick}>
<div className="product" onClick={onClick}>
<div className="product__img">
<img src={product.thumbnail} />
<img src={product.thumbnail} alt="" />
</div>
<div className="product__content">
<div className="title">{product.title}</div>
Expand All @@ -23,6 +24,6 @@ export default function ProductItem({ product }: { product: IProduct }) {
</p>
</div>
</div>
</li>
</div>
);
}
1 change: 1 addition & 0 deletions src/templates/category/categoryPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export default function CategoryPage() {
<div className="category__content">
{category.map((item: CategoryType) => (
<div
key={item.id}
onClick={() => {
onClick(item);
}}>
Expand Down
1 change: 1 addition & 0 deletions src/templates/homePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useRouter } from 'next/navigation';

export default function HomePage() {
const router = useRouter();

return (
<>
<Header />
Expand Down
14 changes: 10 additions & 4 deletions src/templates/product/productDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import 'slick-carousel/slick/slick-theme.css';
import 'slick-carousel/slick/slick.css';

import ProductDelete from './productDelete';
import ProductPut from './productPut';

type Seller = {
sellerId: number;
Expand Down Expand Up @@ -130,7 +131,7 @@ export const ProductDetail = () => {
autoplay: false, // 자동 재생
arrows: false,
};

console.log(product);
return (
<div id="product-detail">
<div className="product-detail">
Expand Down Expand Up @@ -159,9 +160,10 @@ export const ProductDetail = () => {
role="button"
ref={menuRef}
className="product-detail__menu">
<div onClick={() => router.push('/product/edit')}>
<div onClick={() => router.push(`/product/${id}/edit`)}>
게시글 수정
</div>

<div onClick={toggleModal}>삭제</div>
</div>
)}
Expand Down Expand Up @@ -222,7 +224,11 @@ export const ProductDetail = () => {
<div>
<div className="more-product__title">
<p>{product?.seller.nickname}님의 판매상품</p>
<Btn type="button" href="products" label="모두보기" />
<Btn
type="button"
href={`products?id=${id}`}
label="모두보기"
/>
</div>

<div className="more-product__grid">
Expand All @@ -232,7 +238,7 @@ export const ProductDetail = () => {
onClick={() => router.push(`/product/${product.id}`)}
className="more-product"
key={index}>
<img src={product.thumbnail} alt="sale image" />
<img src={product.thumbnail} alt="saleImage" />
<p>{product.title}</p>
<p>{product.price}</p>
</div>
Expand Down
Loading

0 comments on commit 08f8a1d

Please sign in to comment.