Commit 3f60ac1c by Arjun Jhukal

updated the minor changes

parent 0396e588
...@@ -23,7 +23,6 @@ export default function AgeGate() { ...@@ -23,7 +23,6 @@ export default function AgeGate() {
if (data.data.is_age_verified) return; if (data.data.is_age_verified) return;
const uuid = data.data.age_verify_uuid; const uuid = data.data.age_verify_uuid;
// 1. Set config BEFORE loading the script
(window as any).AgeCheckerConfig = { (window as any).AgeCheckerConfig = {
key: process.env.NEXT_PUBLIC_AGE_CHECKER_KEY, key: process.env.NEXT_PUBLIC_AGE_CHECKER_KEY,
mode: "manual", mode: "manual",
......
...@@ -111,18 +111,30 @@ export default function RegisterPage() { ...@@ -111,18 +111,30 @@ export default function RegisterPage() {
useEffect(() => { useEffect(() => {
const fetchCountries = async () => { const fetchCountries = async () => {
try { try {
const res = await fetch("https://restcountries.com/v3.1/all?fields=name,idd"); const res = await fetch(
"https://restcountries.com/v3.1/all?fields=name,idd"
);
if (!res.ok) {
throw new Error("Failed to fetch countries");
}
const data = await res.json(); const data = await res.json();
const formatted = data const formatted = data
.filter((c: any) => c.idd?.root) .filter((country: any) => country?.idd?.root)
.map((c: any) => { .map((country: any) => {
const dial = `${c.idd.root}${c.idd.suffixes?.[0] || ''}`; const root = country.idd.root;
const suffix = country.idd.suffixes?.[0] || "";
// 🔥 Special case: If root is "+1", do NOT append suffix
const dialCode =
root === "+1" ? root : `${root}${suffix}`;
return { return {
name: c.name.common, name: country.name.common,
label: `${c.name.common} (${dial}) `, label: `${country.name.common} (${dialCode})`,
dialCode: dial, dialCode,
}; };
}) })
.sort((a: any, b: any) => .sort((a: any, b: any) =>
...@@ -130,8 +142,10 @@ export default function RegisterPage() { ...@@ -130,8 +142,10 @@ export default function RegisterPage() {
); );
setCountryCodes(formatted); setCountryCodes(formatted);
} catch (err: any) { } catch (error: any) {
console.error(err.message || "Country fetch failed"); console.error(
error?.message || "Country fetch failed"
);
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment