diff --git a/.env b/.env index f70f84e..d121a32 100644 --- a/.env +++ b/.env @@ -7,3 +7,5 @@ REACT_APP_APIGATE='http://float-gat.dev.chiefsoft.net' REACT_APP_APPLE_LINK='https://apps.apple.com/us/app/float-mobility/id1465369130' REACT_APP_GOOGLE_PLAY_LINK='https://apps.apple.com/us/app/float-mobility/id1465369130' + +REACT_APP_SITE_ENDPOINT='https://float-gat.dev.chiefsoft.net/en/floatweb/api/v1/' \ No newline at end of file diff --git a/src/App.js b/src/App.js index 2b831b7..3618bac 100644 --- a/src/App.js +++ b/src/App.js @@ -20,14 +20,6 @@ import GetStarted from './pages/GetStarted'; import FindEv from "./pages/FindEv"; import FindMobility from "./pages/FindMobility"; - - -// import { -// BrowserRouter as Router, -// Routes, -// Route -// } from "react-router-dom"; - import { Routes, Route } from "react-router-dom"; diff --git a/src/pages/Faqs.js b/src/pages/Faqs.js index 224ba64..7e50612 100644 --- a/src/pages/Faqs.js +++ b/src/pages/Faqs.js @@ -1,26 +1,48 @@ import React, {Component} from 'react'; +import SiteService from './assests/utils/SiteService'; -class Faqs extends React.Component { +class Faqs extends Component { + constructor({data, loading, error}){ + super({data, loading, error}) + this.state = { + data: null, + loading: true, + error: null + } + } + + async componentDidMount() { + const apiCall = new SiteService + try { + const data = await apiCall.faqData(); + + this.setState = { + data: data, + loading: false + } + } catch (error) { + this.setState = { + error: error, + loading: false + } + } + } render() { + const {data, loading, error} = this.state + console.log(data) + console.log(error) return(
- - - {/* PRELOADER SPINNER - ============================================= */} + {/* PRELOADER SPINNER */}
- {/* PAGE CONTENT - ============================================= */} + {/* PAGE CONTENT */}
- {/* HEADER - ============================================= */} - - {/* FAQs-2 - ============================================= */} + {/* HEADER */} + {/* FAQs-2 */}
{/* SECTION TITLE */} @@ -182,8 +204,7 @@ class Faqs extends React.Component { {/* GEOMETRIC OVERLAY */}
{/* END FAQs-2 */} - {/* DOWNLOAD-2 - ============================================= */} + {/* DOWNLOAD-2 */}
@@ -219,12 +240,8 @@ class Faqs extends React.Component {
{/* End row */}
{/* End container */}
{/* END DOWNLOAD-2 */} -
{/* END PAGE CONTENT */} - - - -
+ ) } } diff --git a/src/pages/assests/utils/SiteService.js b/src/pages/assests/utils/SiteService.js new file mode 100644 index 0000000..66acdb0 --- /dev/null +++ b/src/pages/assests/utils/SiteService.js @@ -0,0 +1,63 @@ +import axios from 'axios'; + +class SiteService { + constructor(){ + console.log("Launched!!") + } + + // GET REQUEST + // Faq Data + faqData(){ + return this.getEndPoint("/faq", null) + } + + // POST REQUEST + // Contact Data + contactData(){ + return this.postEndPoint("/contact") + } + + getEndPoint(uri, req){ + const endPoint = process.env.REACT_APP_SITE_ENDPOINT + uri; + return axios.get(endPoint) + .then((res) => { + console.log('==> GET REQUEST <==') + console.log(res) + return res + }).catch((err) => { + if (err.response) { + //response status is an error code + console.log(err.response.status); + } else if (err.request) { + //response not received though the request was sent + console.log(err.request); + } else { + //an error occurred when setting up the request + console.log(err.message); + } + }) + } + + postEndPoint(uri, req){ + const endPoint = process.env.REACT_APP_SITE_ENDPOINT + uri; + return axios.get(endPoint, req) + .then((res) => { + console.log(res) + console.log('==> POST REQUEST <==') + return res + }).catch((err) => { + if (err.response) { + //response status is an error code + console.log(err.response.status); + } else if (err.request) { + //response not received though the request was sent + console.log(err.request); + } else { + //an error occurred when setting up the request + console.log(err.message); + } + }) + } +} + +export default SiteService \ No newline at end of file