Merge branch 'myfit_contact_page_country_dropdown' of MyFit/www-myfit into master
This commit is contained in:
@@ -1,11 +1,25 @@
|
|||||||
import React, { useEffect } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import Bredcrumb from "../Bredcrumb/Main";
|
import Bredcrumb from "../Bredcrumb/Main";
|
||||||
import BGImg from "../../assets/images/bread_crumb_bg.png";
|
import BGImg from "../../assets/images/bread_crumb_bg.png";
|
||||||
import BGImg1 from "../../assets/images/bread_crumb_bg_one.png";
|
import BGImg1 from "../../assets/images/bread_crumb_bg_one.png";
|
||||||
import BGImg2 from "../../assets/images/bread_crumb_bg_two.png";
|
import BGImg2 from "../../assets/images/bread_crumb_bg_two.png";
|
||||||
|
|
||||||
|
import SiteService from "../../vendors/service/siteService";
|
||||||
|
|
||||||
const Main = ({ brdcum }) => {
|
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 (
|
return (
|
||||||
<>
|
<>
|
||||||
{brdcum.b1 && (
|
{brdcum.b1 && (
|
||||||
@@ -86,6 +100,7 @@ const Main = ({ brdcum }) => {
|
|||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<select className="form-control">
|
<select className="form-control">
|
||||||
<option value="">Country</option>
|
<option value="">Country</option>
|
||||||
|
{countries.length > 0 && countries.map((country, index) => <option key={index} value={country}>{country}</option>)}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
|
|||||||
Vendored
+9
-7
@@ -9,7 +9,9 @@ class SiteService {
|
|||||||
return this.getAuxEnd("blogdata", null);
|
return this.getAuxEnd("blogdata", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
countryData() {}
|
countryData() {
|
||||||
|
return this.getAuxEnd("/country", null);
|
||||||
|
}
|
||||||
|
|
||||||
faqData() {}
|
faqData() {}
|
||||||
|
|
||||||
@@ -20,11 +22,11 @@ class SiteService {
|
|||||||
//---------------------------------------- -----
|
//---------------------------------------- -----
|
||||||
getAuxEnd(uri, reqData) {
|
getAuxEnd(uri, reqData) {
|
||||||
const endPoint = process.env.REACT_APP_AUX_ENDPOINT + uri;
|
const endPoint = process.env.REACT_APP_AUX_ENDPOINT + uri;
|
||||||
Axios.get(endPoint)
|
return Axios.get(endPoint)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log(response);
|
// console.log(response);
|
||||||
res = response;
|
// res = response;
|
||||||
console.log("~~~~~~~ Toks2 GET ~~~~~~~~");
|
// console.log("~~~~~~~ Toks2 GET ~~~~~~~~");
|
||||||
return response;
|
return response;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@@ -41,12 +43,12 @@ class SiteService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getAuxEnd(uri, reqData) {
|
postAuxEnd(uri, reqData) {
|
||||||
const endPoint = process.env.REACT_APP_AUX_ENDPOINT + uri;
|
const endPoint = process.env.REACT_APP_AUX_ENDPOINT + uri;
|
||||||
Axios.post(endPoint)
|
Axios.post(endPoint)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
res = response;
|
// res = response;
|
||||||
console.log("~~~~~~~ Toks2 POST ~~~~~~~~");
|
console.log("~~~~~~~ Toks2 POST ~~~~~~~~");
|
||||||
return response;
|
return response;
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user