Skip to content

Commit

Permalink
Merge pull request #337 from prgrms-web-devcourse-final-project/fix/#331
Browse files Browse the repository at this point in the history


fix: PostRegisterPage 거래희망장소 선택 시 클리어 버그 수정
  • Loading branch information
y0unj1NoH authored Dec 9, 2024
2 parents 67fbbfb + 88d9356 commit 469c72d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/components/organisms/PostRegisterForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ export const PostRegisterForm = ({
label='최저 입찰가'
value={value || ""}
setValue={(value) => {
console.log("price", value);
setValue("minimumPrice", value);
}}
placeholder='최저 입찰가를 입력해주세요.'
Expand Down
6 changes: 3 additions & 3 deletions src/pages/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { HomeTemplate } from "components/templates";
import { useEffect } from "react";
import { useNavigate } from "react-router-dom";
import { http } from "services/api";
import { useHeaderStore, useUserStore } from "stores";
import { useHeaderStore, useUserStore, useFormDataStore } from "stores";
import { IResponse } from "types";
interface IHomePost {
myLocation: string;
Expand All @@ -31,7 +31,7 @@ export const HomePage = () => {
const HOME_API_URL = `/products`;
const HOME_NAVIGATE_URL = "/product";
const navigate = useNavigate();
// const { clear } = useFormDataStore();
const { clear } = useFormDataStore();

/** 백엔드 IHomePost 타입을 프론트 IPost 으로 변환 함수
* @param homePost : IHomePost
Expand Down Expand Up @@ -103,7 +103,7 @@ export const HomePage = () => {
* @returns void
*/
const onHandleRegisterButton = () => {
// clear();
clear();
navigate(HOME_NAVIGATE_URL);
};

Expand Down
1 change: 0 additions & 1 deletion src/pages/PostRegisterPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ export const PostRegisterPage = () => {

const handleClick = useCallback(
(formData: IProductForm) => {
console.log(formData);
if (formData.category && typeof formData.category === "object") {
formData.category = formData.category.value as Category;
}
Expand Down
9 changes: 4 additions & 5 deletions src/stores/formDataStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ interface State {
clear: () => void;
}

export const defaultState: State = {
export const defaultState: Omit<
State,
"setFormData" | "setProductId" | "isFormDataEmpty" | "clear"
> = {
productId: undefined,
formData: {
title: "",
Expand All @@ -29,10 +32,6 @@ export const defaultState: State = {
expiredTime: undefined,
imgUrls: [],
},
setProductId: () => {},
setFormData: () => {},
isFormDataEmpty: () => false,
clear: () => {},
};

export const useFormDataStore: UseBoundStore<StoreApi<State>> = create(
Expand Down

0 comments on commit 469c72d

Please sign in to comment.