service added

This commit is contained in:
DESKTOP-GBA0BK8\Admin
2023-04-08 20:47:18 -04:00
parent f652304468
commit 163a29698f
6 changed files with 165 additions and 5 deletions
+2
View File
@@ -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_AUX_ENDPOINT='https://float-gat.dev.chiefsoft.net/en/floatweb/api/v1/'
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "wwww-float",
"version": "0.2.0",
"version": "0.3.0",
"private": true,
"dependencies": {
"@reduxjs/toolkit": "^1.8.2",
+22 -3
View File
@@ -29,15 +29,34 @@ import FindMobility from "./pages/FindMobility";
// } from "react-router-dom";
import { Routes, Route } from "react-router-dom";
import { useState, useEffect } from "react";
import SiteService from "./svs/SiteService";
function App() {
const [blogData, setBlogData] = useState([]) // for holding
const siteApi = new SiteService(); // instantiating the API SERVICE
const getBlogData = async () => {
try {
const res = await siteApi.blogData();
if(res.status == 200 /* && res.data.status > 0*/){
console.log(res.data.payload);
setBlogData(res.data)
return
}
}catch(error) {
}
};
useEffect(() => {
getBlogData();
}, []);
return (
<div className="App">
<Header/>
<Routes>
<Route path="/" element={<FloatHome/>} />
<Route path="/" element={<FloatHome blogData={blogData} />} />
<Route path="/about" element={<About/>} />
<Route path="/faqs" element={<Faqs/>} />
<Route path="/features" element={<Features/>} />
@@ -48,7 +67,7 @@ function App() {
<Route path="/demo" element={<Demo/>} />
<Route path="/about" element={<About/>} />
<Route path="/blog_listing" element={<Blog_listing/>} />
<Route path="/blogs" element={<Blog_listing/>} />
<Route path="/blogs" element={<Blog_listing blogData={blogData} />} />
<Route path="/contacts" element={<Contacts/>} />
<Route path="/users" element={<Users/>} />
<Route path="/business" element={<Fleet/>} />
+16 -1
View File
@@ -1,7 +1,22 @@
import React, {Component} from 'react';
import React, {Component,useState, useEffect} from 'react';
import SiteService from "../svs/SiteService";
class Blog_listing extends React.Component {
constructor(props) {
super(props);
// Don't call this.setState() here!
// this.state = { counter: 0 };
// this.handleClick = this.handleClick.bind(this);
console.log("OLU-AMEY BLOG LISTING ",props.blogData);
}
render() {
// const [blogData, setBlogData] = useState([]) // for holding
//const siteApi = new SiteService(); // instantiating the API SERVICE
return(
<div>
+40
View File
@@ -15,6 +15,15 @@ import Assistant from '../pages/assests/images/assistant (2).ico'
class FloatHome extends React.Component {
constructor(props) {
super(props);
// Don't call this.setState() here!
// this.state = { counter: 0 };
// this.handleClick = this.handleClick.bind(this);
console.log("OLU-AMEY 22",props.blogData);
}
render() {
return(
<div>
@@ -1041,6 +1050,36 @@ class FloatHome extends React.Component {
</div>
{/* BLOG POSTS */}
<div className="row">
{
this.props.blogData?.blogdata?.map((x) => {
<div id="b-post-1" className="col-md-6 col-lg-4">
<div className="blog-post mb-40 wow fadeInUp" data-wow-delay="0.4s">
{/* BLOG POST IMAGE */}
<div className="blog-post-img">
<img className="img-fluid" src="assets/images/blog/post-1-img.jpg" alt="blog-post-image" />
</div>
{/* BLOG POST TEXT */}
<div className="blog-post-txt">
{/* Post Tag */}
<p className="p-md post-tag">Float News</p>
{/* Post Link */}
<h5 className="h5-sm">
<a href="single-post.html">{x.title}</a>
</h5>
{/* Text */}
<p className="p-md">Aliqum mullam blandit vitae tempor sapien a donec lipsum gravida porta velna dolor vitae auctor
congue
</p>
{/* Post Meta */}
<div className="post-meta">
<div className="post-author-avatar"><img src="assets/images/post-author-1.jpg" alt="author-avatar" /></div>
<p>12 min read</p>
</div>
</div>
</div>
</div>
})
}
{/* BLOG POST #1 */}
<div id="b-post-1" className="col-md-6 col-lg-4">
<div className="blog-post mb-40 wow fadeInUp" data-wow-delay="0.4s">
@@ -1122,6 +1161,7 @@ class FloatHome extends React.Component {
</div> {/* END BLOG POST TEXT */}
</div>
</div> {/* END BLOG POST #3 */}
</div> {/* END BLOG POSTS */}
</div> {/* End container */}
</section> {/* END BLOG-1 */}
+84
View File
@@ -0,0 +1,84 @@
//https://float-gat.dev.chiefsoft.net/en/floatweb/api/v1/wp
import React from "react";
import Axios from "axios";
class SiteService {
constructor() {
console.log("Site Service Entered");
}
// Blog Data {Get}
blogData() {
return this.getAuxEnd("/blogdata", null);
}
// Country Data {GET}
countryData() {
return this.getAuxEnd("/country", null);
}
// Contact Data{POST}
contactData() {
return this.postAuxEnd("/contact", null)
}
faqData() {
return this.getAuxEnd("/faq", null);
}
priceData() {
return this.getAuxEnd("/pricing", null);
}
//---------------------------------------- -----
//---------------------------------------- -----
// Unified call below
//---------------------------------------- -----
//---------------------------------------- -----
getAuxEnd(uri, reqData) {
const endPoint = process.env.REACT_APP_AUX_ENDPOINT + uri;
return Axios.get(endPoint)
.then((response) => {
// console.log(response);
// res = response;
// console.log("~~~~~~~ Toks2 GET ~~~~~~~~");
return response;
})
.catch((error) => {
if (error.response) {
//response status is an error code
console.log(error.response.status);
} else if (error.request) {
//response not received though the request was sent
console.log(error.request);
} else {
//an error occurred when setting up the request
console.log(error.message);
}
});
}
postAuxEnd(uri, reqData) {
const endPoint = process.env.REACT_APP_AUX_ENDPOINT + uri;
return Axios.post(endPoint, reqData)
.then((response) => {
console.log(response);
// res = response;
console.log("~~~~~~~ Toks2 POST ~~~~~~~~");
return response;
})
.catch((error) => {
if (error.response) {
//response status is an error code
console.log(error.response.status);
} else if (error.request) {
//response not received though the request was sent
console.log(error.request);
} else {
//an error occurred when setting up the request
console.log(error.message);
}
});
}
}
export default SiteService;