Skip to content

Commit

Permalink
Merge pull request #169 from bsideproject/QA
Browse files Browse the repository at this point in the history
회원 탈퇴 관련 체크박스 버그 수정
  • Loading branch information
boxak authored Dec 2, 2023
2 parents 1da9609 + 8e4608c commit 766a46d
Showing 1 changed file with 36 additions and 3 deletions.
39 changes: 36 additions & 3 deletions src/pages/setting/SettingWithdrawal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const SettingWithdrawal = () => {
const [isOkOpen, setIsOkOpen] = useState<boolean>(false);
const [reason, setReason] = useState<any>("");
const [etcReason, setEctReason] = useState<string>("");
const [activeSubmit, setActiveSubmit] = useState<boolean>(false);

const [checkList, setCheckList] = useState<boolean[]>([false, false, false, false, false, false]);

Expand All @@ -20,13 +21,45 @@ const SettingWithdrawal = () => {

tempList[index] = !tempList[index];

console.log("check : " + index, tempList[index]);
let flag : boolean = false;

// 기타를 제외하고 체크가 있는지
for (let i = 0;i<5;i++) {
if (tempList[i] === true) {
flag = true;
break;
}
}

// 기타에 체크되어 있고 내용이 입력되어 있는지
if (flag === false && tempList[5] === true && etcReason.length > 0) {
flag = true;
}

setActiveSubmit(flag);

setCheckList(tempList);
}

const handleEtcReason = (e : any) => {
setEctReason(e.target.value);

const etc : string = e.target.value;

setEctReason(etc);

if (etc.length === 0) {
let flag = false;
for (let i = 0;i<5;i++) {
if (checkList[i] === true) {
flag = true;
break;
}
}

setActiveSubmit(flag);
} else {
setActiveSubmit(true);
}
}

const handleWithdrawal = () => {
Expand Down Expand Up @@ -104,7 +137,7 @@ const SettingWithdrawal = () => {
<button
className="save-button"
onClick={handleWithdrawal}
disabled={reason === ""}
disabled={!activeSubmit}
>탈퇴하기</button>
</div>
<ModalConfirm
Expand Down

0 comments on commit 766a46d

Please sign in to comment.