diff --git a/src/API.js b/src/API.js
index 6c1e3f2..6fd7b63 100644
--- a/src/API.js
+++ b/src/API.js
@@ -31,6 +31,7 @@ export const URL = {
myPage: '/user/mypage/',
myPost: '/mypost/',
password: '/user/password/',
+ deleteAccount: '/user/deleteMessage/',
user: '/user/',
brand: '/brand/',
product: '/product/',
diff --git a/src/App.jsx b/src/App.jsx
index d0f62b9..a573d8a 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -5,7 +5,13 @@ import { ThemeProvider } from 'styled-components';
import theme from './styles/Themes.styles';
import { OverlayProvider } from '@toss/use-overlay';
-const queryClient = new QueryClient();
+const queryClient = new QueryClient({
+ defaultOptions: {
+ queries: {
+ suspense: true,
+ },
+ },
+});
const App = () => {
return (
diff --git a/src/assets/phone.svg b/src/assets/phone.svg
index b6a4b8a..cbd3230 100644
--- a/src/assets/phone.svg
+++ b/src/assets/phone.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
diff --git a/src/components/CheckBox/index.jsx b/src/components/CheckBox/index.jsx
index c02e10f..2096095 100644
--- a/src/components/CheckBox/index.jsx
+++ b/src/components/CheckBox/index.jsx
@@ -1,6 +1,6 @@
import * as S from '../../styles/CheckBox.styles';
-function CheckBox({ name, id, text, checked, setChecked }) {
+function CheckBox({ name, id, text, checked, setChecked, readOnly = false }) {
return (
setChecked(!checked)}
+ disabled={readOnly}
+ onChange={(e) => setChecked(e.target.checked)}
/>
{name}
diff --git a/src/components/ItemIssues/index.jsx b/src/components/ItemIssues/index.jsx
new file mode 100644
index 0000000..8415f7f
--- /dev/null
+++ b/src/components/ItemIssues/index.jsx
@@ -0,0 +1,76 @@
+import { useCallback } from 'react';
+import * as S from '../../styles/ItemIssues.styles';
+import CheckBox from '../CheckBox';
+
+function ItemIssues({ readOnly, itemIssues, setItemIssues }) {
+ const setChecked = useCallback(
+ (key) =>
+ readOnly
+ ? () => {}
+ : (value) => setItemIssues((prev) => ({ ...prev, [key]: value })),
+ [readOnly, setItemIssues]
+ );
+
+ return (
+
+
+
+
+
+
+
+
+
+ );
+}
+
+export default ItemIssues;
diff --git a/src/hooks/network/post.js b/src/hooks/network/post.js
index 935bd4c..b9d3c68 100644
--- a/src/hooks/network/post.js
+++ b/src/hooks/network/post.js
@@ -1,5 +1,5 @@
import { API, URL } from '../../API';
-import { useQuery } from 'react-query';
+import { useMutation, useQuery } from 'react-query';
const getPosts = async ({ my, page }) => {
const pageString = page ? `?page=${page}` : '';
@@ -30,3 +30,17 @@ export const usePost = (id) => {
return data;
};
+
+const addPost = async (data) => {
+ const { data: res } = await API.post(URL.post, data, {
+ headers: {
+ 'Content-Type': 'multipart/form-data',
+ },
+ });
+ return res;
+};
+
+export const useAddPost = (formData) => {
+ const data = useMutation(() => addPost(formData));
+ return data;
+};
diff --git a/src/pages/PostDetail/index.jsx b/src/pages/PostDetail/index.jsx
index a98a805..007f794 100644
--- a/src/pages/PostDetail/index.jsx
+++ b/src/pages/PostDetail/index.jsx
@@ -14,6 +14,8 @@ import Button from '../../components/Button';
import { useOverlay } from '@toss/use-overlay';
import { Suspense } from 'react';
import CustomDialog from '../../components/CustomDialog';
+import ItemIssues from '../../components/ItemIssues';
+import Spacer from '../../components/Spacer';
const PostDetail = () => {
const overlay = useOverlay();
@@ -45,12 +47,17 @@ const PostDetail = () => {
{data.text}
+
제품 사진
image.image)} />
+
가격 {data.price.toLocaleString()}원
diff --git a/src/pages/WriteSteps/ItemIssuesStep.jsx b/src/pages/WriteSteps/ItemIssuesStep.jsx
new file mode 100644
index 0000000..2db9ab3
--- /dev/null
+++ b/src/pages/WriteSteps/ItemIssuesStep.jsx
@@ -0,0 +1,32 @@
+import Button from '../../components/Button';
+import ButtonArea from '../../components/ButtonArea';
+import ItemIssues from '../../components/ItemIssues';
+import * as S from '../../styles/WriteSteps.styles';
+
+function ItemIssuesStep({
+ gotoNextStep,
+ gotoPrevStep,
+ itemIssues,
+ setItemIssues,
+}) {
+ return (
+
+ 휴대폰 상태에 대해 알려주세요
+
+
+
+
+
+
+ );
+}
+
+export default ItemIssuesStep;
diff --git a/src/pages/WriteSteps/PhotoStep.jsx b/src/pages/WriteSteps/PhotoStep.jsx
index ed773e0..e647bdb 100644
--- a/src/pages/WriteSteps/PhotoStep.jsx
+++ b/src/pages/WriteSteps/PhotoStep.jsx
@@ -1,3 +1,4 @@
+import { useState } from 'react';
import Button from '../../components/Button';
import ButtonArea from '../../components/ButtonArea';
import ImageInput from '../../components/ImageInput';
@@ -12,8 +13,11 @@ function PhotoStep({ gotoNextStep, gotoPrevStep, photos, setPhotos }) {
Array.from(files).forEach((file) =>
newPhotos.push(URL.createObjectURL(file))
);
- setPhotos(newPhotos);
+ setPhotos(files);
+ setPreviewPhotos(newPhotos);
};
+ const [previewPhotos, setPreviewPhotos] = useState([]);
+
return (
휴대폰 사진을 올려주세요
@@ -23,7 +27,7 @@ function PhotoStep({ gotoNextStep, gotoPrevStep, photos, setPhotos }) {
onChange={handleChange}
/>
- {photos.length > 0 && }
+ {photos.length > 0 && }