From d6b6abca786fc143649c8d45e6c0d98ffd318c9e Mon Sep 17 00:00:00 2001 From: sunpaaaa Date: Fri, 20 Oct 2023 14:27:12 +0900 Subject: [PATCH 1/3] =?UTF-8?q?Chore=20:=20eslint=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.json | 18 +- package.json | 3 + pnpm-lock.yaml | 413 +++++++++++++++++++++-- src/api/service.ts | 5 + src/app/product/products/page.tsx | 9 + src/templates/product/productDetail.tsx | 6 +- src/templates/product/productShowAll.tsx | 19 ++ 7 files changed, 431 insertions(+), 42 deletions(-) create mode 100644 src/app/product/products/page.tsx create mode 100644 src/templates/product/productShowAll.tsx diff --git a/.eslintrc.json b/.eslintrc.json index 6f79fb1..56ed3b6 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -37,13 +37,15 @@ "react/jsx-filename-extension": ["warn", { "extensions": [".tsx"] }], "import/extensions": "off", "prettier/prettier": ["error", { "endOfLine": "auto" }], - "react/function-component-definition": [ - 2, - { - "namedComponents": "arrow-function", - "unnamedComponents": "arrow-function" - } - ], - "import/prefer-default-export": "off" + // "react/function-component-definition": [ + // 2, + // { + // "namedComponents": "arrow-function", + // "unnamedComponents": "arrow-function" + // } + // ], + "import/prefer-default-export": "off", + "jsx-a11y/click-events-have-key-events": "off", + "jsx-a11y/no-static-element-interactions": "off" } } diff --git a/package.json b/package.json index 2d9ce5e..af31085 100644 --- a/package.json +++ b/package.json @@ -30,9 +30,12 @@ "@types/react": "^18", "@types/react-dom": "^18", "@types/react-slick": "^0.23.10", + "@typescript-eslint/eslint-plugin": "^6.7.5", + "@typescript-eslint/parser": "^6.7.5", "eslint": "^8", "eslint-config-next": "13.5.4", "eslint-config-prettier": "^9.0.0", + "eslint-plugin-prettier": "^5.0.1", "prettier": "^3.0.3", "typescript": "^5" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9321d0d..e91e508 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -64,6 +64,12 @@ devDependencies: '@types/react-slick': specifier: ^0.23.10 version: 0.23.10 + '@typescript-eslint/eslint-plugin': + specifier: ^6.7.5 + version: 6.8.0(@typescript-eslint/parser@6.8.0)(eslint@8.50.0)(typescript@5.2.2) + '@typescript-eslint/parser': + specifier: ^6.7.5 + version: 6.8.0(eslint@8.50.0)(typescript@5.2.2) eslint: specifier: ^8 version: 8.50.0 @@ -73,6 +79,9 @@ devDependencies: eslint-config-prettier: specifier: ^9.0.0 version: 9.0.0(eslint@8.50.0) + eslint-plugin-prettier: + specifier: ^5.0.1 + version: 5.0.1(eslint-config-prettier@9.0.0)(eslint@8.50.0)(prettier@3.0.3) prettier: specifier: ^3.0.3 version: 3.0.3 @@ -1631,6 +1640,18 @@ packages: fastq: 1.15.0 dev: true + /@pkgr/utils@2.4.2: + resolution: {integrity: sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw==} + engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} + dependencies: + cross-spawn: 7.0.3 + fast-glob: 3.3.1 + is-glob: 4.0.3 + open: 9.1.0 + picocolors: 1.0.0 + tslib: 2.6.2 + dev: true + /@rushstack/eslint-patch@1.5.1: resolution: {integrity: sha512-6i/8UoL0P5y4leBIGzvkZdS85RDMG9y1ihZzmTZQ5LdHUYmZ7pKFoj8X0236s3lusPs1Fa5HTQUpwI+UfTcmeA==} dev: true @@ -1653,6 +1674,10 @@ packages: resolution: {integrity: sha512-vMMnFF+H5KYqdd/myCzq6wLDlPpteJK+jGFgBus3Da7lw+YsDmx2C8feGTzY2M3Fo823yON+HC2CL240j4OV+w==} dev: false + /@types/json-schema@7.0.14: + resolution: {integrity: sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw==} + dev: true + /@types/json5@0.0.29: resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} dev: true @@ -1693,12 +1718,45 @@ packages: resolution: {integrity: sha512-2L9ifAGl7wmXwP4v3pN4p2FLhD0O1qsJpvKmNin5VA8+UvNVb447UDaAEV6UdrkA+m/Xs58U1RFps44x6TFsVQ==} dev: true + /@types/semver@7.5.4: + resolution: {integrity: sha512-MMzuxN3GdFwskAnb6fz0orFvhfqi752yjaXylr0Rp4oDg5H0Zn1IuyRhDVvYOwAXoJirx2xuS16I3WjxnAIHiQ==} + dev: true + /@types/stylis@4.2.1: resolution: {integrity: sha512-OSaMrXUKxVigGlKRrET39V2xdhzlztQ9Aqumn1WbCBKHOi9ry7jKSd7rkyj0GzmWaU960Rd+LpOFpLfx5bMQAg==} dev: false - /@typescript-eslint/parser@6.7.4(eslint@8.50.0)(typescript@5.2.2): - resolution: {integrity: sha512-I5zVZFY+cw4IMZUeNCU7Sh2PO5O57F7Lr0uyhgCJmhN/BuTlnc55KxPonR4+EM3GBdfiCyGZye6DgMjtubQkmA==} + /@typescript-eslint/eslint-plugin@6.8.0(@typescript-eslint/parser@6.8.0)(eslint@8.50.0)(typescript@5.2.2): + resolution: {integrity: sha512-GosF4238Tkes2SHPQ1i8f6rMtG6zlKwMEB0abqSJ3Npvos+doIlc/ATG+vX1G9coDF3Ex78zM3heXHLyWEwLUw==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + '@typescript-eslint/parser': ^6.0.0 || ^6.0.0-alpha + eslint: ^7.0.0 || ^8.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@eslint-community/regexpp': 4.9.1 + '@typescript-eslint/parser': 6.8.0(eslint@8.50.0)(typescript@5.2.2) + '@typescript-eslint/scope-manager': 6.8.0 + '@typescript-eslint/type-utils': 6.8.0(eslint@8.50.0)(typescript@5.2.2) + '@typescript-eslint/utils': 6.8.0(eslint@8.50.0)(typescript@5.2.2) + '@typescript-eslint/visitor-keys': 6.8.0 + debug: 4.3.4 + eslint: 8.50.0 + graphemer: 1.4.0 + ignore: 5.2.4 + natural-compare: 1.4.0 + semver: 7.5.4 + ts-api-utils: 1.0.3(typescript@5.2.2) + typescript: 5.2.2 + transitivePeerDependencies: + - supports-color + dev: true + + /@typescript-eslint/parser@6.8.0(eslint@8.50.0)(typescript@5.2.2): + resolution: {integrity: sha512-5tNs6Bw0j6BdWuP8Fx+VH4G9fEPDxnVI7yH1IAPkQH5RUtvKwRoqdecAPdQXv4rSOADAaz1LFBZvZG7VbXivSg==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -1707,10 +1765,10 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 6.7.4 - '@typescript-eslint/types': 6.7.4 - '@typescript-eslint/typescript-estree': 6.7.4(typescript@5.2.2) - '@typescript-eslint/visitor-keys': 6.7.4 + '@typescript-eslint/scope-manager': 6.8.0 + '@typescript-eslint/types': 6.8.0 + '@typescript-eslint/typescript-estree': 6.8.0(typescript@5.2.2) + '@typescript-eslint/visitor-keys': 6.8.0 debug: 4.3.4 eslint: 8.50.0 typescript: 5.2.2 @@ -1718,21 +1776,41 @@ packages: - supports-color dev: true - /@typescript-eslint/scope-manager@6.7.4: - resolution: {integrity: sha512-SdGqSLUPTXAXi7c3Ob7peAGVnmMoGzZ361VswK2Mqf8UOYcODiYvs8rs5ILqEdfvX1lE7wEZbLyELCW+Yrql1A==} + /@typescript-eslint/scope-manager@6.8.0: + resolution: {integrity: sha512-xe0HNBVwCph7rak+ZHcFD6A+q50SMsFwcmfdjs9Kz4qDh5hWhaPhFjRs/SODEhroBI5Ruyvyz9LfwUJ624O40g==} engines: {node: ^16.0.0 || >=18.0.0} dependencies: - '@typescript-eslint/types': 6.7.4 - '@typescript-eslint/visitor-keys': 6.7.4 + '@typescript-eslint/types': 6.8.0 + '@typescript-eslint/visitor-keys': 6.8.0 + dev: true + + /@typescript-eslint/type-utils@6.8.0(eslint@8.50.0)(typescript@5.2.2): + resolution: {integrity: sha512-RYOJdlkTJIXW7GSldUIHqc/Hkto8E+fZN96dMIFhuTJcQwdRoGN2rEWA8U6oXbLo0qufH7NPElUb+MceHtz54g==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + eslint: ^7.0.0 || ^8.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/typescript-estree': 6.8.0(typescript@5.2.2) + '@typescript-eslint/utils': 6.8.0(eslint@8.50.0)(typescript@5.2.2) + debug: 4.3.4 + eslint: 8.50.0 + ts-api-utils: 1.0.3(typescript@5.2.2) + typescript: 5.2.2 + transitivePeerDependencies: + - supports-color dev: true - /@typescript-eslint/types@6.7.4: - resolution: {integrity: sha512-o9XWK2FLW6eSS/0r/tgjAGsYasLAnOWg7hvZ/dGYSSNjCh+49k5ocPN8OmG5aZcSJ8pclSOyVKP2x03Sj+RrCA==} + /@typescript-eslint/types@6.8.0: + resolution: {integrity: sha512-p5qOxSum7W3k+llc7owEStXlGmSl8FcGvhYt8Vjy7FqEnmkCVlM3P57XQEGj58oqaBWDQXbJDZxwUWMS/EAPNQ==} engines: {node: ^16.0.0 || >=18.0.0} dev: true - /@typescript-eslint/typescript-estree@6.7.4(typescript@5.2.2): - resolution: {integrity: sha512-ty8b5qHKatlNYd9vmpHooQz3Vki3gG+3PchmtsA4TgrZBKWHNjWfkQid7K7xQogBqqc7/BhGazxMD5vr6Ha+iQ==} + /@typescript-eslint/typescript-estree@6.8.0(typescript@5.2.2): + resolution: {integrity: sha512-ISgV0lQ8XgW+mvv5My/+iTUdRmGspducmQcDw5JxznasXNnZn3SKNrTRuMsEXv+V/O+Lw9AGcQCfVaOPCAk/Zg==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: typescript: '*' @@ -1740,8 +1818,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 6.7.4 - '@typescript-eslint/visitor-keys': 6.7.4 + '@typescript-eslint/types': 6.8.0 + '@typescript-eslint/visitor-keys': 6.8.0 debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 @@ -1752,11 +1830,30 @@ packages: - supports-color dev: true - /@typescript-eslint/visitor-keys@6.7.4: - resolution: {integrity: sha512-pOW37DUhlTZbvph50x5zZCkFn3xzwkGtNoJHzIM3svpiSkJzwOYr/kVBaXmf+RAQiUDs1AHEZVNPg6UJCJpwRA==} + /@typescript-eslint/utils@6.8.0(eslint@8.50.0)(typescript@5.2.2): + resolution: {integrity: sha512-dKs1itdE2qFG4jr0dlYLQVppqTE+Itt7GmIf/vX6CSvsW+3ov8PbWauVKyyfNngokhIO9sKZeRGCUo1+N7U98Q==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + eslint: ^7.0.0 || ^8.0.0 + dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@8.50.0) + '@types/json-schema': 7.0.14 + '@types/semver': 7.5.4 + '@typescript-eslint/scope-manager': 6.8.0 + '@typescript-eslint/types': 6.8.0 + '@typescript-eslint/typescript-estree': 6.8.0(typescript@5.2.2) + eslint: 8.50.0 + semver: 7.5.4 + transitivePeerDependencies: + - supports-color + - typescript + dev: true + + /@typescript-eslint/visitor-keys@6.8.0: + resolution: {integrity: sha512-oqAnbA7c+pgOhW2OhGvxm0t1BULX5peQI/rLsNDpGM78EebV3C9IGbX5HNZabuZ6UQrYveCLjKo8Iy/lLlBkkg==} engines: {node: ^16.0.0 || >=18.0.0} dependencies: - '@typescript-eslint/types': 6.7.4 + '@typescript-eslint/types': 6.8.0 eslint-visitor-keys: 3.4.3 dev: true @@ -1976,11 +2073,23 @@ packages: /balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + /big-integer@1.6.51: + resolution: {integrity: sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==} + engines: {node: '>=0.6'} + dev: true + /binary-extensions@2.2.0: resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} engines: {node: '>=8'} dev: false + /bplist-parser@0.2.0: + resolution: {integrity: sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==} + engines: {node: '>= 5.10.0'} + dependencies: + big-integer: 1.6.51 + dev: true + /brace-expansion@1.1.11: resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} dependencies: @@ -2004,6 +2113,13 @@ packages: update-browserslist-db: 1.0.13(browserslist@4.22.1) dev: false + /bundle-name@3.0.0: + resolution: {integrity: sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==} + engines: {node: '>=12'} + dependencies: + run-applescript: 5.0.0 + dev: true + /busboy@1.6.0: resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==} engines: {node: '>=10.16.0'} @@ -2190,6 +2306,24 @@ packages: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} dev: true + /default-browser-id@3.0.0: + resolution: {integrity: sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA==} + engines: {node: '>=12'} + dependencies: + bplist-parser: 0.2.0 + untildify: 4.0.0 + dev: true + + /default-browser@4.0.0: + resolution: {integrity: sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA==} + engines: {node: '>=14.16'} + dependencies: + bundle-name: 3.0.0 + default-browser-id: 3.0.0 + execa: 7.2.0 + titleize: 3.0.0 + dev: true + /define-data-property@1.1.0: resolution: {integrity: sha512-UzGwzcjyv3OtAvolTj1GoyNYzfFR+iqbGjcnBEENZVCpM4/Ng1yhGNvS3lR/xDS74Tb2wGG9WzNSNIOS9UVb2g==} engines: {node: '>= 0.4'} @@ -2199,6 +2333,11 @@ packages: has-property-descriptors: 1.0.0 dev: true + /define-lazy-prop@3.0.0: + resolution: {integrity: sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==} + engines: {node: '>=12'} + dev: true + /define-properties@1.2.1: resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} engines: {node: '>= 0.4'} @@ -2373,11 +2512,11 @@ packages: dependencies: '@next/eslint-plugin-next': 13.5.4 '@rushstack/eslint-patch': 1.5.1 - '@typescript-eslint/parser': 6.7.4(eslint@8.50.0)(typescript@5.2.2) + '@typescript-eslint/parser': 6.8.0(eslint@8.50.0)(typescript@5.2.2) eslint: 8.50.0 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@6.7.4)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.28.1)(eslint@8.50.0) - eslint-plugin-import: 2.28.1(@typescript-eslint/parser@6.7.4)(eslint-import-resolver-typescript@3.6.1)(eslint@8.50.0) + eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@6.8.0)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.28.1)(eslint@8.50.0) + eslint-plugin-import: 2.28.1(@typescript-eslint/parser@6.8.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.50.0) eslint-plugin-jsx-a11y: 6.7.1(eslint@8.50.0) eslint-plugin-react: 7.33.2(eslint@8.50.0) eslint-plugin-react-hooks: 4.6.0(eslint@8.50.0) @@ -2406,7 +2545,7 @@ packages: - supports-color dev: true - /eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@6.7.4)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.28.1)(eslint@8.50.0): + /eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@6.8.0)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.28.1)(eslint@8.50.0): resolution: {integrity: sha512-xgdptdoi5W3niYeuQxKmzVDTATvLYqhpwmykwsh7f6HIOStGWEIL9iqZgQDF9u9OEzrRwR8no5q2VT+bjAujTg==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: @@ -2416,8 +2555,8 @@ packages: debug: 4.3.4 enhanced-resolve: 5.15.0 eslint: 8.50.0 - eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.7.4)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.50.0) - eslint-plugin-import: 2.28.1(@typescript-eslint/parser@6.7.4)(eslint-import-resolver-typescript@3.6.1)(eslint@8.50.0) + eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.8.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.50.0) + eslint-plugin-import: 2.28.1(@typescript-eslint/parser@6.8.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.50.0) fast-glob: 3.3.1 get-tsconfig: 4.7.2 is-core-module: 2.13.0 @@ -2429,7 +2568,7 @@ packages: - supports-color dev: true - /eslint-module-utils@2.8.0(@typescript-eslint/parser@6.7.4)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.50.0): + /eslint-module-utils@2.8.0(@typescript-eslint/parser@6.8.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.50.0): resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==} engines: {node: '>=4'} peerDependencies: @@ -2450,16 +2589,16 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 6.7.4(eslint@8.50.0)(typescript@5.2.2) + '@typescript-eslint/parser': 6.8.0(eslint@8.50.0)(typescript@5.2.2) debug: 3.2.7 eslint: 8.50.0 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@6.7.4)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.28.1)(eslint@8.50.0) + eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@6.8.0)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.28.1)(eslint@8.50.0) transitivePeerDependencies: - supports-color dev: true - /eslint-plugin-import@2.28.1(@typescript-eslint/parser@6.7.4)(eslint-import-resolver-typescript@3.6.1)(eslint@8.50.0): + /eslint-plugin-import@2.28.1(@typescript-eslint/parser@6.8.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.50.0): resolution: {integrity: sha512-9I9hFlITvOV55alzoKBI+K9q74kv0iKMeY6av5+umsNwayt59fz692daGyjR+oStBQgx6nwR9rXldDev3Clw+A==} engines: {node: '>=4'} peerDependencies: @@ -2469,7 +2608,7 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 6.7.4(eslint@8.50.0)(typescript@5.2.2) + '@typescript-eslint/parser': 6.8.0(eslint@8.50.0)(typescript@5.2.2) array-includes: 3.1.7 array.prototype.findlastindex: 1.2.3 array.prototype.flat: 1.3.2 @@ -2478,7 +2617,7 @@ packages: doctrine: 2.1.0 eslint: 8.50.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.7.4)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.50.0) + eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.8.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.50.0) has: 1.0.3 is-core-module: 2.13.0 is-glob: 4.0.3 @@ -2519,6 +2658,27 @@ packages: semver: 6.3.1 dev: true + /eslint-plugin-prettier@5.0.1(eslint-config-prettier@9.0.0)(eslint@8.50.0)(prettier@3.0.3): + resolution: {integrity: sha512-m3u5RnR56asrwV/lDC4GHorlW75DsFfmUcjfCYylTUs85dBRnB7VM6xG8eCMJdeDRnppzmxZVf1GEPJvl1JmNg==} + engines: {node: ^14.18.0 || >=16.0.0} + peerDependencies: + '@types/eslint': '>=8.0.0' + eslint: '>=8.0.0' + eslint-config-prettier: '*' + prettier: '>=3.0.0' + peerDependenciesMeta: + '@types/eslint': + optional: true + eslint-config-prettier: + optional: true + dependencies: + eslint: 8.50.0 + eslint-config-prettier: 9.0.0(eslint@8.50.0) + prettier: 3.0.3 + prettier-linter-helpers: 1.0.0 + synckit: 0.8.5 + dev: true + /eslint-plugin-react-hooks@4.6.0(eslint@8.50.0): resolution: {integrity: sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==} engines: {node: '>=10'} @@ -2644,10 +2804,44 @@ packages: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} engines: {node: '>=0.10.0'} + /execa@5.1.1: + resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==} + engines: {node: '>=10'} + dependencies: + cross-spawn: 7.0.3 + get-stream: 6.0.1 + human-signals: 2.1.0 + is-stream: 2.0.1 + merge-stream: 2.0.0 + npm-run-path: 4.0.1 + onetime: 5.1.2 + signal-exit: 3.0.7 + strip-final-newline: 2.0.0 + dev: true + + /execa@7.2.0: + resolution: {integrity: sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==} + engines: {node: ^14.18.0 || ^16.14.0 || >=18.0.0} + dependencies: + cross-spawn: 7.0.3 + get-stream: 6.0.1 + human-signals: 4.3.1 + is-stream: 3.0.0 + merge-stream: 2.0.0 + npm-run-path: 5.1.0 + onetime: 6.0.0 + signal-exit: 3.0.7 + strip-final-newline: 3.0.0 + dev: true + /fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} dev: true + /fast-diff@1.3.0: + resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==} + dev: true + /fast-glob@3.3.1: resolution: {integrity: sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==} engines: {node: '>=8.6.0'} @@ -2778,6 +2972,11 @@ packages: has-symbols: 1.0.3 dev: true + /get-stream@6.0.1: + resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==} + engines: {node: '>=10'} + dev: true + /get-symbol-description@1.0.0: resolution: {integrity: sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==} engines: {node: '>= 0.4'} @@ -2917,6 +3116,16 @@ packages: dependencies: function-bind: 1.1.1 + /human-signals@2.1.0: + resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} + engines: {node: '>=10.17.0'} + dev: true + + /human-signals@4.3.1: + resolution: {integrity: sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==} + engines: {node: '>=14.18.0'} + dev: true + /ignore@5.2.4: resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==} engines: {node: '>= 4'} @@ -3010,6 +3219,18 @@ packages: has-tostringtag: 1.0.0 dev: true + /is-docker@2.2.1: + resolution: {integrity: sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==} + engines: {node: '>=8'} + hasBin: true + dev: true + + /is-docker@3.0.0: + resolution: {integrity: sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + hasBin: true + dev: true + /is-extglob@2.1.1: resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} engines: {node: '>=0.10.0'} @@ -3033,6 +3254,14 @@ packages: dependencies: is-extglob: 2.1.1 + /is-inside-container@1.0.0: + resolution: {integrity: sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==} + engines: {node: '>=14.16'} + hasBin: true + dependencies: + is-docker: 3.0.0 + dev: true + /is-map@2.0.2: resolution: {integrity: sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==} dev: true @@ -3076,6 +3305,16 @@ packages: call-bind: 1.0.2 dev: true + /is-stream@2.0.1: + resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} + engines: {node: '>=8'} + dev: true + + /is-stream@3.0.0: + resolution: {integrity: sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dev: true + /is-string@1.0.7: resolution: {integrity: sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==} engines: {node: '>= 0.4'} @@ -3114,6 +3353,13 @@ packages: get-intrinsic: 1.2.1 dev: true + /is-wsl@2.2.0: + resolution: {integrity: sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==} + engines: {node: '>=8'} + dependencies: + is-docker: 2.2.1 + dev: true + /isarray@2.0.5: resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} dev: true @@ -3269,6 +3515,10 @@ packages: semver: 5.7.2 dev: false + /merge-stream@2.0.0: + resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} + dev: true + /merge2@1.4.1: resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} engines: {node: '>= 8'} @@ -3294,6 +3544,16 @@ packages: mime-db: 1.52.0 dev: false + /mimic-fn@2.1.0: + resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} + engines: {node: '>=6'} + dev: true + + /mimic-fn@4.0.0: + resolution: {integrity: sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==} + engines: {node: '>=12'} + dev: true + /minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} dependencies: @@ -3369,6 +3629,20 @@ packages: engines: {node: '>=0.10.0'} dev: false + /npm-run-path@4.0.1: + resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} + engines: {node: '>=8'} + dependencies: + path-key: 3.1.1 + dev: true + + /npm-run-path@5.1.0: + resolution: {integrity: sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + path-key: 4.0.0 + dev: true + /object-assign@4.1.1: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} engines: {node: '>=0.10.0'} @@ -3441,6 +3715,30 @@ packages: dependencies: wrappy: 1.0.2 + /onetime@5.1.2: + resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} + engines: {node: '>=6'} + dependencies: + mimic-fn: 2.1.0 + dev: true + + /onetime@6.0.0: + resolution: {integrity: sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==} + engines: {node: '>=12'} + dependencies: + mimic-fn: 4.0.0 + dev: true + + /open@9.1.0: + resolution: {integrity: sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==} + engines: {node: '>=14.16'} + dependencies: + default-browser: 4.0.0 + define-lazy-prop: 3.0.0 + is-inside-container: 1.0.0 + is-wsl: 2.2.0 + dev: true + /optionator@0.9.3: resolution: {integrity: sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==} engines: {node: '>= 0.8.0'} @@ -3488,6 +3786,11 @@ packages: engines: {node: '>=8'} dev: true + /path-key@4.0.0: + resolution: {integrity: sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==} + engines: {node: '>=12'} + dev: true + /path-parse@1.0.7: resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} @@ -3498,7 +3801,6 @@ packages: /picocolors@1.0.0: resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} - dev: false /picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} @@ -3533,6 +3835,13 @@ packages: engines: {node: '>= 0.8.0'} dev: true + /prettier-linter-helpers@1.0.0: + resolution: {integrity: sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==} + engines: {node: '>=6.0.0'} + dependencies: + fast-diff: 1.3.0 + dev: true + /prettier@3.0.3: resolution: {integrity: sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==} engines: {node: '>=14'} @@ -3713,6 +4022,13 @@ packages: glob: 7.2.3 dev: true + /run-applescript@5.0.0: + resolution: {integrity: sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==} + engines: {node: '>=12'} + dependencies: + execa: 5.1.1 + dev: true + /run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} dependencies: @@ -3803,6 +4119,10 @@ packages: object-inspect: 1.12.3 dev: true + /signal-exit@3.0.7: + resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} + dev: true + /slash@2.0.0: resolution: {integrity: sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==} engines: {node: '>=6'} @@ -3886,6 +4206,16 @@ packages: engines: {node: '>=4'} dev: true + /strip-final-newline@2.0.0: + resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} + engines: {node: '>=6'} + dev: true + + /strip-final-newline@3.0.0: + resolution: {integrity: sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==} + engines: {node: '>=12'} + dev: true + /strip-json-comments@3.1.1: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} engines: {node: '>=8'} @@ -3967,6 +4297,14 @@ packages: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} + /synckit@0.8.5: + resolution: {integrity: sha512-L1dapNV6vu2s/4Sputv8xGsCdAVlb5nRDMFU/E27D44l5U6cw1g0dGd45uLc+OXjNMmF4ntiMdCimzcjFKQI8Q==} + engines: {node: ^14.18.0 || >=16.0.0} + dependencies: + '@pkgr/utils': 2.4.2 + tslib: 2.6.2 + dev: true + /tapable@2.2.1: resolution: {integrity: sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==} engines: {node: '>=6'} @@ -3976,6 +4314,11 @@ packages: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} dev: true + /titleize@3.0.0: + resolution: {integrity: sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ==} + engines: {node: '>=12'} + dev: true + /to-fast-properties@2.0.0: resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} engines: {node: '>=4'} @@ -4007,7 +4350,6 @@ packages: /tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} - dev: false /type-check@0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} @@ -4097,6 +4439,11 @@ packages: engines: {node: '>=4'} dev: false + /untildify@4.0.0: + resolution: {integrity: sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==} + engines: {node: '>=8'} + dev: true + /update-browserslist-db@1.0.13(browserslist@4.22.1): resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==} hasBin: true diff --git a/src/api/service.ts b/src/api/service.ts index e5f4eb3..0d0ca81 100644 --- a/src/api/service.ts +++ b/src/api/service.ts @@ -59,6 +59,11 @@ export const getProducts = async (searchWord?: string, category?: string) => { return res.data; }; +export const getUserProducts = async (id: number) => { + const res = await client.get(`/products/${id}/list`); + return res.data; +}; + export const postSignUp = async ( email: string, password: string, diff --git a/src/app/product/products/page.tsx b/src/app/product/products/page.tsx new file mode 100644 index 0000000..2b5760d --- /dev/null +++ b/src/app/product/products/page.tsx @@ -0,0 +1,9 @@ +import ProductShowAll from '@/templates/product/productShowAll'; + +export default function Page() { + return ( + <> + + + ); +} diff --git a/src/templates/product/productDetail.tsx b/src/templates/product/productDetail.tsx index 139b6b1..ea2270c 100644 --- a/src/templates/product/productDetail.tsx +++ b/src/templates/product/productDetail.tsx @@ -184,7 +184,11 @@ export const ProductDetail = () => {

{product?.seller.nickname}님의 판매상품

- +
diff --git a/src/templates/product/productShowAll.tsx b/src/templates/product/productShowAll.tsx new file mode 100644 index 0000000..5446019 --- /dev/null +++ b/src/templates/product/productShowAll.tsx @@ -0,0 +1,19 @@ +'use client'; +import Header from '@/components/header'; +import ProductStateList from './productStateList/productStateList'; +import { useState } from 'react'; +import { IProduct } from '@/types/interface'; + +export default function ProductShowAll() { + const [filter, setFilter] = useState('all'); + const [products, setProducts] = useState([]); + const handleChangeList = (state: string) => { + setFilter(state); + }; + return ( + <> +
+ + + ); +} From 69dc911427cf0c1726fb1dac2880d6ba0d5196f2 Mon Sep 17 00:00:00 2001 From: sunpaaaa Date: Fri, 20 Oct 2023 14:59:33 +0900 Subject: [PATCH 2/3] =?UTF-8?q?Feat=20:=20=ED=8C=90=EB=A7=A4=EC=9E=90=20?= =?UTF-8?q?=EC=A0=84=EC=B2=B4=20=EC=83=81=ED=92=88=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 +- pnpm-lock.yaml | 90 ++++++++++--------- src/api/service.ts | 2 +- src/components/productState.tsx | 10 +-- src/templates/mypage/mypageSale.tsx | 7 +- src/templates/product/productDetail.tsx | 33 +++++-- .../productStateList/productStateList.tsx | 13 ++- 7 files changed, 93 insertions(+), 66 deletions(-) diff --git a/package.json b/package.json index af31085..129f3ee 100644 --- a/package.json +++ b/package.json @@ -32,11 +32,11 @@ "@types/react-slick": "^0.23.10", "@typescript-eslint/eslint-plugin": "^6.7.5", "@typescript-eslint/parser": "^6.7.5", - "eslint": "^8", + "eslint": "^8.50.0", "eslint-config-next": "13.5.4", "eslint-config-prettier": "^9.0.0", "eslint-plugin-prettier": "^5.0.1", "prettier": "^3.0.3", "typescript": "^5" } -} +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b62735e..cc1f2d2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7,10 +7,10 @@ settings: dependencies: '@types/cookie': specifier: ^0.5.2 - version: 0.5.2 + version: 0.5.3 '@types/js-cookie': specifier: ^3.0.4 - version: 3.0.4 + version: 3.0.5 axios: specifier: ^1.5.1 version: 1.5.1 @@ -25,10 +25,10 @@ dependencies: version: 3.0.5 next: specifier: 13.5.4 - version: 13.5.4(@babel/core@7.23.0)(react-dom@18.2.0)(react@18.2.0)(sass@1.68.0) + version: 13.5.4(@babel/core@7.23.0)(react-dom@18.2.0)(react@18.2.0)(sass@1.69.4) pnpm: specifier: ^8.8.0 - version: 8.8.0 + version: 8.9.2 react: specifier: ^18 version: 18.2.0 @@ -43,7 +43,7 @@ dependencies: version: 0.29.0(react-dom@18.2.0)(react@18.2.0) sass: specifier: ^1.68.0 - version: 1.68.0 + version: 1.69.4 slick-carousel: specifier: ^1.8.1 version: 1.8.1(jquery@3.7.1) @@ -71,7 +71,7 @@ devDependencies: specifier: ^6.7.5 version: 6.8.0(eslint@8.50.0)(typescript@5.2.2) eslint: - specifier: ^8 + specifier: ^8.50.0 version: 8.50.0 eslint-config-next: specifier: 13.5.4 @@ -260,10 +260,10 @@ packages: semver: 6.3.1 dev: false - /@babel/helper-define-polyfill-provider@0.4.2(@babel/core@7.23.0): + /@babel/helper-define-polyfill-provider@0.4.3(@babel/core@7.23.0): resolution: { - integrity: sha512-k0qnnOqHn5dK9pZpfD5XXZ9SojAITdCKRn2Lp6rnDGzIbaP0rHyMPk/4wsSxVBVz4RfN0q6VpXWP2pDGIoQ7hw==, + integrity: sha512-WBrLmuPP47n7PNwsZ57pqam6G/RGo1vw/87b0Blc53tZNGZ4x7YvZ6HgQe2vo1W/FR20OgjeZuGXzudPiXHFug==, } peerDependencies: '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 @@ -1664,9 +1664,9 @@ packages: '@babel/plugin-transform-unicode-sets-regex': 7.22.5(@babel/core@7.23.0) '@babel/preset-modules': 0.1.6-no-external-plugins(@babel/core@7.23.0) '@babel/types': 7.23.0 - babel-plugin-polyfill-corejs2: 0.4.5(@babel/core@7.23.0) - babel-plugin-polyfill-corejs3: 0.8.4(@babel/core@7.23.0) - babel-plugin-polyfill-regenerator: 0.5.2(@babel/core@7.23.0) + babel-plugin-polyfill-corejs2: 0.4.6(@babel/core@7.23.0) + babel-plugin-polyfill-corejs3: 0.8.5(@babel/core@7.23.0) + babel-plugin-polyfill-regenerator: 0.5.3(@babel/core@7.23.0) core-js-compat: 3.33.0 semver: 6.3.1 transitivePeerDependencies: @@ -2130,24 +2130,24 @@ packages: } dev: false - /@types/cookie@0.5.2: + /@types/cookie@0.5.3: resolution: { - integrity: sha512-DBpRoJGKJZn7RY92dPrgoMew8xCWc2P71beqsjyhEI/Ds9mOyVmBwtekyfhpwFIVt1WrxTonFifiOZ62V8CnNA==, + integrity: sha512-SLg07AS9z1Ab2LU+QxzU8RCmzsja80ywjf/t5oqw+4NSH20gIGlhLOrBDm1L3PBWzPa4+wkgFQVZAjE6Ioj2ug==, } dev: false - /@types/js-cookie@3.0.4: + /@types/js-cookie@3.0.5: resolution: { - integrity: sha512-vMMnFF+H5KYqdd/myCzq6wLDlPpteJK+jGFgBus3Da7lw+YsDmx2C8feGTzY2M3Fo823yON+HC2CL240j4OV+w==, + integrity: sha512-dtLshqoiGRDHbHueIT9sjkd2F4tW1qPSX2xKAQK8p1e6pM+Z913GM1shv7dOqqasEMYbC5zEaClJomQe8OtQLA==, } dev: false - /@types/json-schema@7.0.14: + /@types/json-schema@7.0.13: resolution: { - integrity: sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw==, + integrity: sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ==, } dev: true @@ -2158,10 +2158,10 @@ packages: } dev: true - /@types/node@16.18.58: + /@types/node@16.18.59: resolution: { - integrity: sha512-YGncyA25/MaVtQkjWW9r0EFBukZ+JulsLcVZBlGUfIb96OBMjkoRWwQo5IEWJ8Fj06Go3GHw+bjYDitv6BaGsA==, + integrity: sha512-PJ1w2cNeKUEdey4LiPra0ZuxZFOGvetswE8qHRriV/sUkL5Al4tTmPV9D2+Y/TPIxTHHgxTfRjZVKWhPw/ORhQ==, } dev: false @@ -2215,10 +2215,10 @@ packages: } dev: true - /@types/semver@7.5.4: + /@types/semver@7.5.3: resolution: { - integrity: sha512-MMzuxN3GdFwskAnb6fz0orFvhfqi752yjaXylr0Rp4oDg5H0Zn1IuyRhDVvYOwAXoJirx2xuS16I3WjxnAIHiQ==, + integrity: sha512-OxepLK9EuNEIPxWNME+C6WwbRAOOI2o2BaQEGzz5Lu2e4Z5eDnEo+/aVEDMIXywoJitJ7xWd641wrGLZdtwRyw==, } dev: true @@ -2361,8 +2361,8 @@ packages: eslint: ^7.0.0 || ^8.0.0 dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.50.0) - '@types/json-schema': 7.0.14 - '@types/semver': 7.5.4 + '@types/json-schema': 7.0.13 + '@types/semver': 7.5.3 '@typescript-eslint/scope-manager': 6.8.0 '@typescript-eslint/types': 6.8.0 '@typescript-eslint/typescript-estree': 6.8.0(typescript@5.2.2) @@ -2633,47 +2633,47 @@ packages: dequal: 2.0.3 dev: true - /babel-plugin-polyfill-corejs2@0.4.5(@babel/core@7.23.0): + /babel-plugin-polyfill-corejs2@0.4.6(@babel/core@7.23.0): resolution: { - integrity: sha512-19hwUH5FKl49JEsvyTcoHakh6BE0wgXLLptIyKZ3PijHc/Ci521wygORCUCCred+E/twuqRyAkE02BAWPmsHOg==, + integrity: sha512-jhHiWVZIlnPbEUKSSNb9YoWcQGdlTLq7z1GHL4AjFxaoOUMuuEVJ+Y4pAaQUGOGk93YsVCKPbqbfw3m0SM6H8Q==, } peerDependencies: '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 dependencies: '@babel/compat-data': 7.22.20 '@babel/core': 7.23.0 - '@babel/helper-define-polyfill-provider': 0.4.2(@babel/core@7.23.0) + '@babel/helper-define-polyfill-provider': 0.4.3(@babel/core@7.23.0) semver: 6.3.1 transitivePeerDependencies: - supports-color dev: false - /babel-plugin-polyfill-corejs3@0.8.4(@babel/core@7.23.0): + /babel-plugin-polyfill-corejs3@0.8.5(@babel/core@7.23.0): resolution: { - integrity: sha512-9l//BZZsPR+5XjyJMPtZSK4jv0BsTO1zDac2GC6ygx9WLGlcsnRd1Co0B2zT5fF5Ic6BZy+9m3HNZ3QcOeDKfg==, + integrity: sha512-Q6CdATeAvbScWPNLB8lzSO7fgUVBkQt6zLgNlfyeCr/EQaEQR+bWiBYYPYAFyE528BMjRhL+1QBMOI4jc/c5TA==, } peerDependencies: '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 dependencies: '@babel/core': 7.23.0 - '@babel/helper-define-polyfill-provider': 0.4.2(@babel/core@7.23.0) + '@babel/helper-define-polyfill-provider': 0.4.3(@babel/core@7.23.0) core-js-compat: 3.33.0 transitivePeerDependencies: - supports-color dev: false - /babel-plugin-polyfill-regenerator@0.5.2(@babel/core@7.23.0): + /babel-plugin-polyfill-regenerator@0.5.3(@babel/core@7.23.0): resolution: { - integrity: sha512-tAlOptU0Xj34V1Y2PNTL4Y0FOJMDB6bZmoW39FeCQIhigGLkqu3Fj6uiXpxIf6Ij274ENdYx64y6Au+ZKlb1IA==, + integrity: sha512-8sHeDOmXC8csczMrYEOf0UTNa4yE2SxV5JGeT/LP1n0OYVDUUFPxG9vdk2AlDlIit4t+Kf0xCtpgXPBwnn/9pw==, } peerDependencies: '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 dependencies: '@babel/core': 7.23.0 - '@babel/helper-define-polyfill-provider': 0.4.2(@babel/core@7.23.0) + '@babel/helper-define-polyfill-provider': 0.4.3(@babel/core@7.23.0) transitivePeerDependencies: - supports-color dev: false @@ -2698,6 +2698,7 @@ packages: integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==, } engines: { node: '>=8' } + requiresBuild: true dev: false /bplist-parser@0.2.0: @@ -2936,7 +2937,7 @@ packages: } dependencies: '@types/cookie': 0.4.1 - '@types/node': 16.18.58 + '@types/node': 16.18.59 cookie: 0.4.2 dev: false @@ -3689,10 +3690,10 @@ packages: } dev: true - /fast-diff@1.3.0: + /fast-diff@1.1.2: resolution: { - integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==, + integrity: sha512-KaJUt+M9t1qaIteSvjc6P3RbMdXsNhK61GRftR6SNxqmhthcd9MGIi4T+o0jD8LUSpSnSKXE20nLtJ3fOHxQig==, } dev: true @@ -3749,6 +3750,7 @@ packages: integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==, } engines: { node: '>=8' } + requiresBuild: true dependencies: to-regex-range: 5.0.1 @@ -4212,6 +4214,7 @@ packages: integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==, } engines: { node: '>=8' } + requiresBuild: true dependencies: binary-extensions: 2.2.0 dev: false @@ -4348,6 +4351,7 @@ packages: integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==, } engines: { node: '>=0.12.0' } + requiresBuild: true /is-path-inside@3.0.3: resolution: @@ -4806,7 +4810,7 @@ packages: } dev: true - /next@13.5.4(@babel/core@7.23.0)(react-dom@18.2.0)(react@18.2.0)(sass@1.68.0): + /next@13.5.4(@babel/core@7.23.0)(react-dom@18.2.0)(react@18.2.0)(sass@1.69.4): resolution: { integrity: sha512-+93un5S779gho8y9ASQhb/bTkQF17FNQOtXLKAj3lsNgltEcF0C5PMLLncDmH+8X1EnJH1kbqAERa29nRXqhjA==, @@ -4831,7 +4835,7 @@ packages: postcss: 8.4.31 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) - sass: 1.68.0 + sass: 1.69.4 styled-jsx: 5.1.1(@babel/core@7.23.0)(react@18.2.0) watchpack: 2.4.0 optionalDependencies: @@ -5130,10 +5134,10 @@ packages: engines: { node: '>=6' } dev: false - /pnpm@8.8.0: + /pnpm@8.9.2: resolution: { - integrity: sha512-eY5rMiZpzmPI2oVr1irR97bzb036oKwCWvK91wDQndXcqUPlytPtrF0bO668Syw/uA+7hTf5NnM8Mr4ux4BRRA==, + integrity: sha512-udNf6RsqWFTa3EMDSj57LmdfpLVuIOjgnvB4+lU8GPiu1EBR57Nui43UNfl+sMRMT/O0T8fG+n0h4frBe75mHg==, } engines: { node: '>=16.14' } hasBin: true @@ -5173,7 +5177,7 @@ packages: } engines: { node: '>=6.0.0' } dependencies: - fast-diff: 1.3.0 + fast-diff: 1.1.2 dev: true /prettier@3.0.3: @@ -5283,6 +5287,7 @@ packages: integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==, } engines: { node: '>=8.10.0' } + requiresBuild: true dependencies: picomatch: 2.3.1 dev: false @@ -5477,10 +5482,10 @@ packages: is-regex: 1.1.4 dev: true - /sass@1.68.0: + /sass@1.69.4: resolution: { - integrity: sha512-Lmj9lM/fef0nQswm1J2HJcEsBUba4wgNx2fea6yJHODREoMFnwRpZydBnX/RjyXw2REIwdkbqE4hrTo4qfDBUA==, + integrity: sha512-+qEreVhqAy8o++aQfCJwp0sklr2xyEzkm9Pp/Igu9wNPoe7EZEQ8X/MBvvXggI2ql607cxKg/RKOwDj6pp2XDA==, } engines: { node: '>=14.0.0' } hasBin: true @@ -5865,6 +5870,7 @@ packages: integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==, } engines: { node: '>=8.0' } + requiresBuild: true dependencies: is-number: 7.0.0 diff --git a/src/api/service.ts b/src/api/service.ts index cac5893..a85fd2f 100644 --- a/src/api/service.ts +++ b/src/api/service.ts @@ -128,4 +128,4 @@ export const addWishProduct = async (id: number) => { export const deleteWishProduct = async (id: number) => { const res = await client.delete(`wish/${id}`); return res; -}; +}; \ No newline at end of file diff --git a/src/components/productState.tsx b/src/components/productState.tsx index 7a62304..11b21d3 100644 --- a/src/components/productState.tsx +++ b/src/components/productState.tsx @@ -6,30 +6,30 @@ export default function ProductState({ setReLoad, }: { product: IProduct; - setReLoad: React.Dispatch>; + setReLoad: React.Dispatch>; }) { return ( <>
-

{ await updateProductState(product.id, 1); setReLoad((prev: boolean) => !prev); }} className="product__state__btn--reserve"> 판매중 변경 -

+
-

{ await updateProductState(product.id, 3); setReLoad((prev: boolean) => !prev); }} className="product__state__btn--complete"> 거래완료 변경 -

+
diff --git a/src/templates/mypage/mypageSale.tsx b/src/templates/mypage/mypageSale.tsx index 410372e..10a126f 100644 --- a/src/templates/mypage/mypageSale.tsx +++ b/src/templates/mypage/mypageSale.tsx @@ -3,14 +3,17 @@ import { getMyProduct } from '@/api/service'; import Header from '@/components/header'; import ProductItem from '@/components/productItem'; import ProductState from '@/components/productState'; +import 'src/styles/templates/mypage/mypageSales.scss'; import ProductStateList from '@/templates/product/productStateList/productStateList'; import { AXIOSResponse, IProduct } from '@/types/interface'; -import { useState,useEffect,Fragment } from 'react'; +import { useState, useEffect, Fragment } from 'react'; export default function MypageSale() { const [productList, setProductList] = useState('all'); const [reLoad, setReLoad] = useState(false); const [myProducts, setMyProducts] = useState([]); - const handleChangeList = (state: string) => { + const handleChangeList: React.Dispatch> = ( + state, + ) => { setProductList(state); }; useEffect(() => { diff --git a/src/templates/product/productDetail.tsx b/src/templates/product/productDetail.tsx index 9267ac1..0ff5b34 100644 --- a/src/templates/product/productDetail.tsx +++ b/src/templates/product/productDetail.tsx @@ -3,6 +3,7 @@ import { addWishProduct, deleteWishProduct, getProductDetail, + updateProductState, } from '@/api/service'; import Btn from '@/components/btn'; import Header from '@/components/header'; @@ -48,7 +49,6 @@ export const ProductDetail = () => { const router = useRouter(); const path = usePathname(); const id = path.split('/')[2]; - const productId: number | any = typeof id === 'string' ? parseInt(id, 10) : undefined; @@ -56,6 +56,15 @@ export const ProductDetail = () => { const [onLike, setOnLike] = useState(false); const [isMenuOpen, setIsMenuOpen] = useState(false); const menuRef = useRef(null); + const [selectedValue, setSelectedValue] = useState('1'); + const selectRef = useRef(null); + const handleSelectChange = () => { + if (selectRef.current) { + const selectedOption = selectRef.current.value; + setSelectedValue(selectedOption); + updateProductState(productId, parseInt(selectedOption, 10)); + } + }; const toggleMenu = () => { setIsMenuOpen(!isMenuOpen); @@ -83,14 +92,21 @@ export const ProductDetail = () => { if (res.statusCode === 200) { setProduct(res.data); setOnLike(res.data?.like); + if (res.data.status === '판매중') { + setSelectedValue('1'); + } else if (res.data.status === '예약중') { + setSelectedValue('2'); + } else if (res.data.status === '거래완료') { + setSelectedValue('3'); + } else { + return; + } } } catch (error) { console.error(error); } }; - fetchData(); - return () => { setProduct(null); []; @@ -160,10 +176,13 @@ export const ProductDetail = () => { {product?.myProduct && ( - + + + )} diff --git a/src/templates/product/productStateList/productStateList.tsx b/src/templates/product/productStateList/productStateList.tsx index 8bac861..46af4b8 100644 --- a/src/templates/product/productStateList/productStateList.tsx +++ b/src/templates/product/productStateList/productStateList.tsx @@ -5,12 +5,11 @@ export default function ProductStateList({ }: { onChangeList: React.Dispatch>; }) { - return ( <>
-

{ const productStates = document.querySelectorAll('.productState'); onChangeList('all'); @@ -20,10 +19,10 @@ export default function ProductStateList({ e.currentTarget.closest('.productState')?.classList.add('active'); }}> 전체 -

+
-

{ const productStates = document.querySelectorAll('.productState'); onChangeList('sale'); @@ -33,10 +32,10 @@ export default function ProductStateList({ e.currentTarget.closest('.productState')?.classList.add('active'); }}> 판매중 -

+
-

{ const productStates = document.querySelectorAll('.productState'); onChangeList('completed'); @@ -46,7 +45,7 @@ export default function ProductStateList({ e.currentTarget.closest('.productState')?.classList.add('active'); }}> 거래완료 -

+
From 7e616bc788ac0fca287555a31ce35ceaaeda9def Mon Sep 17 00:00:00 2001 From: sunpaaaa Date: Fri, 20 Oct 2023 17:46:58 +0900 Subject: [PATCH 3/3] =?UTF-8?q?Feat=20:=20=ED=8A=B9=EC=A0=95=20=EC=9C=A0?= =?UTF-8?q?=EC=A0=80=20=ED=8C=90=EB=A7=A4=EC=83=81=ED=92=88=20=EC=A0=84?= =?UTF-8?q?=EC=B2=B4=EB=B3=B4=EA=B8=B0=20=ED=8E=98=EC=9D=B4=EC=A7=80=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/service.ts | 5 +-- src/components/productItem.tsx | 7 ++-- src/templates/category/categoryPage.tsx | 1 + src/templates/homePage.tsx | 1 + src/templates/product/productDetail.tsx | 4 +-- src/templates/product/productShowAll.tsx | 43 +++++++++++++++++++++--- 6 files changed, 50 insertions(+), 11 deletions(-) diff --git a/src/api/service.ts b/src/api/service.ts index a85fd2f..ff1bee9 100644 --- a/src/api/service.ts +++ b/src/api/service.ts @@ -54,12 +54,13 @@ export const getProducts = async (searchWord?: string, category?: string) => { params: { searchWord, categoryNames: category, + pageSize: 300, // 추후 수정 예정입니다. }, }); return res.data; }; -export const getUserProducts = async (id: number) => { +export const getUserProducts = async (id: string) => { const res = await client.get(`/products/${id}/list`); return res.data; }; @@ -128,4 +129,4 @@ export const addWishProduct = async (id: number) => { export const deleteWishProduct = async (id: number) => { const res = await client.delete(`wish/${id}`); return res; -}; \ No newline at end of file +}; diff --git a/src/components/productItem.tsx b/src/components/productItem.tsx index 574c5dd..5bdf131 100644 --- a/src/components/productItem.tsx +++ b/src/components/productItem.tsx @@ -8,10 +8,11 @@ export default function ProductItem({ product }: { product: IProduct }) { const onClick = () => { router.push(`/product/${[product.id]}`); }; + return ( -
  • +
    - +
    {product.title}
    @@ -23,6 +24,6 @@ export default function ProductItem({ product }: { product: IProduct }) {

    -
  • + ); } diff --git a/src/templates/category/categoryPage.tsx b/src/templates/category/categoryPage.tsx index cfad722..abd4823 100644 --- a/src/templates/category/categoryPage.tsx +++ b/src/templates/category/categoryPage.tsx @@ -35,6 +35,7 @@ export default function CategoryPage() {
    {category.map((item: CategoryType) => (
    { onClick(item); }}> diff --git a/src/templates/homePage.tsx b/src/templates/homePage.tsx index 9984978..61cd667 100644 --- a/src/templates/homePage.tsx +++ b/src/templates/homePage.tsx @@ -6,6 +6,7 @@ import { useRouter } from 'next/navigation'; export default function HomePage() { const router = useRouter(); + return ( <>
    diff --git a/src/templates/product/productDetail.tsx b/src/templates/product/productDetail.tsx index 0ff5b34..6de8210 100644 --- a/src/templates/product/productDetail.tsx +++ b/src/templates/product/productDetail.tsx @@ -122,7 +122,7 @@ export const ProductDetail = () => { autoplay: false, // 자동 재생 arrows: false, }; - + console.log(product); return (
    @@ -206,7 +206,7 @@ export const ProductDetail = () => {

    {product?.seller.nickname}님의 판매상품

    diff --git a/src/templates/product/productShowAll.tsx b/src/templates/product/productShowAll.tsx index 5446019..0cea043 100644 --- a/src/templates/product/productShowAll.tsx +++ b/src/templates/product/productShowAll.tsx @@ -1,19 +1,54 @@ 'use client'; import Header from '@/components/header'; import ProductStateList from './productStateList/productStateList'; -import { useState } from 'react'; -import { IProduct } from '@/types/interface'; +import { useState, useEffect, SetStateAction } from 'react'; +import { AXIOSResponse, IProduct } from '@/types/interface'; +import { useSearchParams } from 'next/navigation'; +import { getUserProducts } from '@/api/service'; +import ProductList from '@/components/productList'; export default function ProductShowAll() { const [filter, setFilter] = useState('all'); const [products, setProducts] = useState([]); - const handleChangeList = (state: string) => { - setFilter(state); + const idParams = useSearchParams(); + const id = idParams.get('id') || ''; + const handleChangeList: React.Dispatch> = ( + value: SetStateAction, + ) => { + setFilter(value); }; + useEffect(() => { + const fetchData = async () => { + const res: AXIOSResponse = await getUserProducts(id); + console.log(res); + if (res.statusCode === 200) { + setProducts(() => { + return res.data.filter((product) => { + if (filter === 'all') { + return product; + } else if ( + filter === 'completed' && + product.status === '거래완료' + ) { + return product; + } else if (filter === 'sale' && product.status === '판매중') { + return product; + } else { + return; + } + }); + }); + } + }; + fetchData(); + }, [filter]); + console.log(products); + return ( <>
    + ); }