Merge branch 'main' of https://git.addwin.ir/addwin/register-invite-requests-front
This commit is contained in:
commit
a71256e353
1 changed files with 20 additions and 2 deletions
22
js/script.js
22
js/script.js
|
|
@ -67,6 +67,19 @@ function getInviteCode() {
|
||||||
return new URLSearchParams(window.location.search).get("inviteCode");
|
return new URLSearchParams(window.location.search).get("inviteCode");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Picks where to send the user after a successful submission, based on platform.
|
||||||
|
function getDownloadRedirectUrl() {
|
||||||
|
const ua = navigator.userAgent || "";
|
||||||
|
|
||||||
|
if (/android/i.test(ua)) {
|
||||||
|
return "https://myket.ir/app/com.adv.winsoo";
|
||||||
|
}
|
||||||
|
if (/iphone|ipad|ipod/i.test(ua)) {
|
||||||
|
return "https://web.winsoo.ir";
|
||||||
|
}
|
||||||
|
return "https://winsoo.ir/#Download";
|
||||||
|
}
|
||||||
|
|
||||||
const PERSIAN_DIGITS = "۰۱۲۳۴۵۶۷۸۹";
|
const PERSIAN_DIGITS = "۰۱۲۳۴۵۶۷۸۹";
|
||||||
const ARABIC_INDIC_DIGITS = "٠١٢٣٤٥٦٧٨٩";
|
const ARABIC_INDIC_DIGITS = "٠١٢٣٤٥٦٧٨٩";
|
||||||
|
|
||||||
|
|
@ -171,12 +184,17 @@ async function handleSubmit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
setMessage("ثبت شماره با موفقیت انجام شد.", "success");
|
setMessage("ثبت شماره با موفقیت انجام شد.", "success");
|
||||||
|
setButtonLoading(true, "در حال انتقال...");
|
||||||
|
setTimeout(() => {
|
||||||
|
window.location.href = getDownloadRedirectUrl();
|
||||||
|
}, 1200);
|
||||||
|
return;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
setMessage(err.message || "خطا در ارسال اطلاعات. لطفاً دوباره تلاش کنید.", "error");
|
setMessage(err.message || "خطا در ارسال اطلاعات. لطفاً دوباره تلاش کنید.", "error");
|
||||||
} finally {
|
|
||||||
setButtonLoading(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setButtonLoading(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
submitBtn.addEventListener("click", handleSubmit);
|
submitBtn.addEventListener("click", handleSubmit);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue