Skip to content

Commit

Permalink
Merge pull request #267 from SCBJ-7/feature/#173-account
Browse files Browse the repository at this point in the history
[#173] 계좌입력 안 해도 진행되는 버그 수정, 계좌 연결 플로우 타다가 돌아와도 체크박스 살아있게 수정, 계좌 연결 플로우 타다가 돌아와도 체크박스 살아있게 수정,  메인 검색바 문구 변경, postValidateEmail을 instance가 아닌 axios로 변경
  • Loading branch information
Bumang-Cyber authored Jan 27, 2024
2 parents 0685ff7 + 59a4655 commit 034db45
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 9 deletions.
5 changes: 2 additions & 3 deletions src/apis/fetchLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import axios from "axios";
import { END_POINTS, BASE_URL } from "@/constants/api";
import type { EmailValidateData, LoginData } from "@type/login";
import type { ResponseData } from "@type/responseType";
import { axiosInstance } from "./axiosInstance";

interface LoginProps {
email: string;
Expand All @@ -29,8 +28,8 @@ export const postLogin = async ({
export const postValidateEmail = async (
email: string,
): Promise<EmailValidateData> => {
const { data } = await axiosInstance.post<ResponseData<EmailValidateData>>(
END_POINTS.EMAIL,
const { data } = await axios.post<ResponseData<EmailValidateData>>(
BASE_URL + END_POINTS.EMAIL,
{ email },
);
return data.data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const NavToSearchSection = () => {

return (
<S.Container onClick={() => navigate(PATH.SEARCH_FILTER)}>
<h4>어떤 호텔을 찾으세요?</h4>
<h4>언제 어디로 떠나세요?</h4>
<S.SearchIcon />
</S.Container>
);
Expand Down
24 changes: 21 additions & 3 deletions src/pages/transferWritingPricePage/TransferWritingPrice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,24 @@ const TransferWritingPrice = () => {
// false : true여야 정상 작동함.
const [firstlyNoAccount] = useState(userData?.accountNumber ? false : true);

useEffect(() => {
setBank(userData?.bank ?? null);
setAccountNumber(userData?.accountNumber ?? null);
}, [userData]);

useEffect(() => {
setReadyToSubmit(() => {
if (firstPrice && opt1 && opt2 && opt3 && optFinal) {
if (
firstPrice &&
opt1 &&
opt2 &&
opt3 &&
optFinal &&
bank &&
accountNumber
) {
// accountNumber 추가
if (!is2ndChecked) return true; // 2차 가격 설정하기 체크 안 경우
if (!is2ndChecked) return true; // 2차 가격 설정하기 체크 안 하고 계좌 등록된 경우

if (is2ndChecked && secondPrice && downTimeAfter) {
return true; // 2차 가격 설정한 경우
Expand All @@ -95,6 +108,8 @@ const TransferWritingPrice = () => {
secondPrice,
downTimeAfter,
userData,
bank,
accountNumber,
]);

// 페이지 전환 시 적용할 효과
Expand Down Expand Up @@ -283,11 +298,14 @@ const TransferWritingPrice = () => {
onSetAccount={setAccountSetting}
/>
<AgreementSection
opt1={opt1}
opt2={opt2}
opt3={opt3}
optFinal={optFinal}
setOpt1={setOpt1}
setOpt2={setOpt2}
setOpt3={setOpt3}
setOptFinal={setOptFinal}
optFinal={optFinal}
/>
<S.ButtonSection $readyToSubmit={readyToSubmit}>
<button onClick={submitHandler}>판매 게시물 올리기</button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import * as S from "./AgreementSection.style";
import CheckBoxSection from "../checkBox/CheckBoxSection";
import { useRef } from "react";
import { useEffect, useRef } from "react";

interface AgreementProps {
opt1: boolean;
opt2: boolean;
opt3: boolean;
optFinal: boolean;
setOpt1: React.Dispatch<React.SetStateAction<boolean>>;
setOpt2: React.Dispatch<React.SetStateAction<boolean>>;
setOpt3: React.Dispatch<React.SetStateAction<boolean>>;
setOptFinal: React.Dispatch<React.SetStateAction<boolean>>;
optFinal: boolean;
}
const TermsSection = ({
opt1,
opt2,
opt3,
optFinal,
setOpt1,
setOpt2,
setOpt3,
Expand All @@ -20,6 +27,21 @@ const TermsSection = ({
const check3Ref = useRef(null);
const check4Ref = useRef(null);

useEffect(() => {
if (opt1 && check1Ref.current) {
(check1Ref.current as HTMLInputElement).checked = true;
}
if (opt2 && check2Ref.current) {
(check2Ref.current as HTMLInputElement).checked = true;
}
if (opt3 && check3Ref.current) {
(check3Ref.current as HTMLInputElement).checked = true;
}
if (optFinal && check4Ref.current) {
(check4Ref.current as HTMLInputElement).checked = true;
}
});

return (
<S.Container initial={{ y: -5, opacity: 0 }} animate={{ y: 0, opacity: 1 }}>
<CheckBoxSection
Expand Down

0 comments on commit 034db45

Please sign in to comment.