diff --git a/src/components/AuthPages/SignUp/index.jsx b/src/components/AuthPages/SignUp/index.jsx
index 02d00b1..3e4e423 100644
--- a/src/components/AuthPages/SignUp/index.jsx
+++ b/src/components/AuthPages/SignUp/index.jsx
@@ -6,15 +6,18 @@ import InputCom from "../../Helpers/Inputs/InputCom";
import AuthLayout from "../AuthLayout";
export default function SignUp() {
+ const queryParams = new URLSearchParams(location?.search);
+ const country = queryParams.get("cnt")?.toUpperCase();
+
const [signUpLoading, setSignUpLoading] = useState(false);
const [checked, setValue] = useState(false);
// for the catch error
const [msgError, setMsgError] = useState("");
const [showPassword, setShowPassword] = useState(false);
- const [countries, setCountries] = useState([]);
+ const [countries, setCountries] = useState({loading:true, data:[]});
const [formData, setFormData] = useState({
- country: "",
+ country: country? country : "",
first_name: "",
last_name: "",
email: "",
@@ -45,9 +48,14 @@ export default function SignUp() {
try {
if (res.status === 200) {
const { signup_country } = await res.data;
- setCountries(signup_country);
+ // setCountries(signup_country);
+ if(country){ // IF LINK/PATHNAME HAS CNT QUERY VALUE
+ let cnt = signup_country.filter(item => item[0]==country)
+ return setCountries({loading: false, data: cnt.length ? signup_country.filter(item => item[0]==country) : signup_country});
+ }
+ setCountries({loading: false, data:signup_country});
} else if (res.data.result !== 100) {
- setCountries("Nothing see here!");
+ setCountries({loading: false, data:[]});
}
} catch (error) {
throw new Error(error);
@@ -352,13 +360,32 @@ const SelectOption = ({
onChange={inputHandler}
value={value}
>
-
- {data?.length > 0 &&
- data?.map((item, idx) => (
+ {data?.data?.length > 1 ?
+ <>
+
+ {data?.data?.map((item, idx) => (
))}
+ >
+ :
+ data?.data?.length == 1 ?
+ data?.data?.map((item, idx) => (
+
+ ))
+ :
+ data?.data?.length < 1 && data.loading ?
+
+ :
+
+ }