Merge branch 'myfit_contact_page_country_dropdown' of MyFit/www-myfit into master

This commit is contained in:
2023-01-12 12:24:46 +00:00
committed by Gogs
2 changed files with 25 additions and 8 deletions
+16 -1
View File
@@ -1,11 +1,25 @@
import React, { useEffect } from "react";
import React, { useEffect, useState } from "react";
import { Link } from "react-router-dom";
import Bredcrumb from "../Bredcrumb/Main";
import BGImg from "../../assets/images/bread_crumb_bg.png";
import BGImg1 from "../../assets/images/bread_crumb_bg_one.png";
import BGImg2 from "../../assets/images/bread_crumb_bg_two.png";
import SiteService from "../../vendors/service/siteService";
const Main = ({ brdcum }) => {
let [countries, setCountries] = useState([]) // initial state for country dropdown
let countryClass = new SiteService() // instantiating the class
const allCountry = () => {
return countryClass.countryData();
}
//CALLS THE API AFTER COMPONENT LOADS
useEffect(()=>{
allCountry().then((data)=> setCountries(Object.values(data.data)))
},[])
return (
<>
{brdcum.b1 && (
@@ -86,6 +100,7 @@ const Main = ({ brdcum }) => {
<div className="form-group">
<select className="form-control">
<option value="">Country</option>
{countries.length > 0 && countries.map((country, index) => <option key={index} value={country}>{country}</option>)}
</select>
</div>
<div className="form-group">
+9 -7
View File
@@ -9,7 +9,9 @@ class SiteService {
return this.getAuxEnd("blogdata", null);
}
countryData() {}
countryData() {
return this.getAuxEnd("/country", null);
}
faqData() {}
@@ -20,11 +22,11 @@ class SiteService {
//---------------------------------------- -----
getAuxEnd(uri, reqData) {
const endPoint = process.env.REACT_APP_AUX_ENDPOINT + uri;
Axios.get(endPoint)
return Axios.get(endPoint)
.then((response) => {
console.log(response);
res = response;
console.log("~~~~~~~ Toks2 GET ~~~~~~~~");
// console.log(response);
// res = response;
// console.log("~~~~~~~ Toks2 GET ~~~~~~~~");
return response;
})
.catch((error) => {
@@ -41,12 +43,12 @@ class SiteService {
});
}
getAuxEnd(uri, reqData) {
postAuxEnd(uri, reqData) {
const endPoint = process.env.REACT_APP_AUX_ENDPOINT + uri;
Axios.post(endPoint)
.then((response) => {
console.log(response);
res = response;
// res = response;
console.log("~~~~~~~ Toks2 POST ~~~~~~~~");
return response;
})