From 163a29698f74518c875c72209bed805800637798 Mon Sep 17 00:00:00 2001 From: "DESKTOP-GBA0BK8\\Admin" Date: Sat, 8 Apr 2023 20:47:18 -0400 Subject: [PATCH 1/2] service added --- .env | 2 + package.json | 2 +- src/App.js | 25 ++++++++++-- src/pages/Blog_listing.js | 17 +++++++- src/pages/FloatHome.js | 40 +++++++++++++++++++ src/svs/SiteService.js | 84 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 165 insertions(+), 5 deletions(-) create mode 100644 src/svs/SiteService.js diff --git a/.env b/.env index f70f84e..cd3888a 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_AUX_ENDPOINT='https://float-gat.dev.chiefsoft.net/en/floatweb/api/v1/' \ No newline at end of file diff --git a/package.json b/package.json index 6c4ff7e..fe439c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wwww-float", - "version": "0.2.0", + "version": "0.3.0", "private": true, "dependencies": { "@reduxjs/toolkit": "^1.8.2", diff --git a/src/App.js b/src/App.js index 2b831b7..6120c69 100644 --- a/src/App.js +++ b/src/App.js @@ -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 (
- } /> + } /> } /> } /> } /> @@ -48,7 +67,7 @@ function App() { } /> } /> } /> - } /> + } /> } /> } /> } /> diff --git a/src/pages/Blog_listing.js b/src/pages/Blog_listing.js index 56e25fa..15685b3 100644 --- a/src/pages/Blog_listing.js +++ b/src/pages/Blog_listing.js @@ -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(
diff --git a/src/pages/FloatHome.js b/src/pages/FloatHome.js index 4e6a96e..5603fc6 100644 --- a/src/pages/FloatHome.js +++ b/src/pages/FloatHome.js @@ -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(
@@ -1041,6 +1050,36 @@ class FloatHome extends React.Component {
{/* BLOG POSTS */}
+ { + this.props.blogData?.blogdata?.map((x) => { +
+
+ {/* BLOG POST IMAGE */} +
+ blog-post-image +
+ {/* BLOG POST TEXT */} +
+ {/* Post Tag */} +

Float News

+ {/* Post Link */} +
+ {x.title} +
+ {/* Text */} +

Aliqum mullam blandit vitae tempor sapien a donec lipsum gravida porta velna dolor vitae auctor + congue +

+ {/* Post Meta */} +
+
author-avatar
+

12 min read

+
+
+
+
+ }) + } {/* BLOG POST #1 */}
@@ -1122,6 +1161,7 @@ class FloatHome extends React.Component {
{/* END BLOG POST TEXT */}
{/* END BLOG POST #3 */} +
{/* END BLOG POSTS */}
{/* End container */} {/* END BLOG-1 */} diff --git a/src/svs/SiteService.js b/src/svs/SiteService.js new file mode 100644 index 0000000..188d259 --- /dev/null +++ b/src/svs/SiteService.js @@ -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; From 1428ddd9255d4ca1115b9bdae92077a89213b478 Mon Sep 17 00:00:00 2001 From: "DESKTOP-GBA0BK8\\Admin" Date: Sun, 9 Apr 2023 20:33:14 -0400 Subject: [PATCH 2/2] Footer update --- src/components/Footer.js | 18 ++++++++++-------- src/pages/Users.js | 4 ++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/components/Footer.js b/src/components/Footer.js index b06196d..d9b1cf8 100644 --- a/src/components/Footer.js +++ b/src/components/Footer.js @@ -12,21 +12,22 @@ class Footer extends React.Component {
-
    - -
  • Users

  • -
  • Fleet Mangers

  • +
      +
    • Stop the Surge

    • +
    • Travel Guide

    • Find Ev Charge

    • Find Options

    • + +
-
    -
  • Our Blog

  • +
      +
    • Users

    • +
    • Fleet Mangers

    • Customer Stories

    • -
    • Help & Support

    • Resources

@@ -35,7 +36,8 @@ class Footer extends React.Component {
  • About Us

  • -
  • Press & Media

  • +
  • Our Blog

  • +
  • Press Kit (Download)

  • Privacy Policy

  • Terms & Privacy

diff --git a/src/pages/Users.js b/src/pages/Users.js index 61833d8..b4eb9ee 100644 --- a/src/pages/Users.js +++ b/src/pages/Users.js @@ -790,8 +790,8 @@ export default Users //HERO SECTION let heroSection = { leadTitle: `Float`, - title: `Your Mobility & Star Access Feed`, - desc: `Stay Connected with Your Fleet`, + title: `Your Mobility Made Smarter`, + desc: `Stay Connected with Your World`, mainSiteLink: 'This leads to users PORTAL', };