feat: redirect routes added

This commit is contained in:
Afra ‌ 2026-07-29 10:56:50 +03:30
parent 0d09ee74c3
commit 1835cb9f49

View file

@ -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 = "٠١٢٣٤٥٦٧٨٩";
@ -157,12 +170,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);