fix: TermsOfService 선택약관동의 여부 수정
This commit is contained in:
@@ -61,6 +61,7 @@ export default function TermsOfService({ title, cbScrollTo }) {
|
||||
const [spotlightDisabled, setSpotlightDisabled] = useState(true);
|
||||
const [termsList, setTermsList] = useState([]);
|
||||
const termsListRef = useRef(termsList);
|
||||
const [localOptionalTermsAgree, setLocalOptionalTermsAgree] = useState(false);
|
||||
|
||||
const dispatch = useDispatch();
|
||||
|
||||
@@ -78,6 +79,10 @@ export default function TermsOfService({ title, cbScrollTo }) {
|
||||
dispatch(fetchCurrentUserHomeTerms());
|
||||
}, [dispatch]);
|
||||
|
||||
useEffect(() => {
|
||||
setLocalOptionalTermsAgree(optionalTermsAgree);
|
||||
}, [optionalTermsAgree]);
|
||||
|
||||
useEffect(() => {
|
||||
// console.log(
|
||||
// "[TermsOfService] termsData:",
|
||||
@@ -258,6 +263,7 @@ export default function TermsOfService({ title, cbScrollTo }) {
|
||||
setMyPageTermsAgree(payload, (response) => {
|
||||
// console.log("setMyPageTermsAgree callback response:", response);
|
||||
if (response.retCode === "000" || response.retCode === 0) {
|
||||
setLocalOptionalTermsAgree(true);
|
||||
console.log("Optional terms agreement successful.");
|
||||
// 약관 동의의 후 약관 정보 조회
|
||||
dispatch(fetchCurrentUserHomeTerms());
|
||||
@@ -314,6 +320,7 @@ export default function TermsOfService({ title, cbScrollTo }) {
|
||||
console.log("Optional terms withdrawal successful.");
|
||||
// 약관 철회 후 약관 정보 조회
|
||||
dispatch(fetchCurrentUserHomeTerms());
|
||||
setLocalOptionalTermsAgree(false);
|
||||
setIsOptionalChecked(false);
|
||||
} else {
|
||||
console.error("Optional terms withdrawal failed:", response);
|
||||
@@ -415,7 +422,7 @@ export default function TermsOfService({ title, cbScrollTo }) {
|
||||
spotlightDisabled={
|
||||
spotlightDisabled || optionalTermsAgree
|
||||
}
|
||||
disabled={optionalTermsAgree}
|
||||
disabled={localOptionalTermsAgree}
|
||||
>
|
||||
{$L("Agree")}
|
||||
</TButton>
|
||||
@@ -424,7 +431,7 @@ export default function TermsOfService({ title, cbScrollTo }) {
|
||||
className={css.disagreeButton}
|
||||
spotlightDisabled={spotlightDisabled || !optionalTermsAgree}
|
||||
spotlightId="optional-disagree-button"
|
||||
disabled={!optionalTermsAgree}
|
||||
disabled={!localOptionalTermsAgree}
|
||||
>
|
||||
{$L("Do Not Agree")}
|
||||
</TButton>
|
||||
|
||||
Reference in New Issue
Block a user