This commit is contained in:
zadit
2025-01-23 06:50:14 +07:00
parent 380fe7dd78
commit 469d786d49
5 changed files with 91 additions and 42 deletions

View File

@@ -16,10 +16,10 @@ const LinktreePage = ({ data, setModal }) => {
// Detect query params on component mount
useEffect(() => {
if(couponCode != '') return;
const code = queryParams.get('couponCode');
console.log(code)
if (code) {
setCouponStatus(200);
setCouponCode(code);
setIsUsingCoupon(true); // Automatically switch to the coupon input state
handleCheckCoupon(code); // Automatically check the coupon code
@@ -144,6 +144,7 @@ const LinktreePage = ({ data, setModal }) => {
period={couponDetails?.discountPeriods}
expiration={couponDetails?.expirationDate}
/>
{couponStatus == 200 &&
<form className={styles.linktreeForm}>
<label htmlFor="username" className={styles.usernameLabel}>
--------------------------------------------
@@ -157,6 +158,7 @@ const LinktreePage = ({ data, setModal }) => {
<span>Buat akun dengan kupon ini</span>
</button>
</form>
}
</>
)}
<div className={styles.footer}>
@@ -176,6 +178,7 @@ const LinktreePage = ({ data, setModal }) => {
// Remove the couponCode query parameter
url.searchParams.delete('couponCode');
url.searchParams.delete('codeStatus');
// Update the browser's URL, but keep 'modal=join' intact
window.history.pushState({}, '', url.toString());