// import logo from './logo.svg';
// import './App.css';
import Header from './components/Header';
import Footer from './components/Footer';
import Faqs from './pages/Faqs';
import Features from './pages/Features';
import Pricing from './pages/Pricing';
import Reviews from './pages/Reviews';
import Single_post from './pages/Single_post';
import Terms from './pages/Terms';
import Demo from './pages/Demo';
import About from './pages/About';
import Blog_listing from './pages/Blog_listing';
import Contacts from './pages/Contacts';
import FloatHome from './pages/FloatHome';
import Users from './pages/Users';
import Fleet from './pages/Fleet';
import Privacy from './pages/Privacy';
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";
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);
				setBlogData(res.data)
				return
			}
		}catch(error) {
			setBlogData({blogdata: []})
		}
	};

	useEffect(() => {
		getBlogData();
	}, []);

  return (
    <div className="App">

	 <Header/>
   	    <Routes>
			<Route path="/" element={<FloatHome blogData={blogData} />} />
			<Route path="/about" element={<About/>} />
			<Route path="/faqs" element={<Faqs/>} />
			<Route path="/features" element={<Features/>} />
			<Route path="/pricing" element={<Pricing/>} />
			<Route path="/reviews" element={<Reviews/>} />
			<Route path="/single_post" element={<Single_post/>} />
			<Route path="/terms" element={<Terms/>} />
			<Route path="/demo" element={<Demo/>} />
			<Route path="/about" element={<About/>} />
			<Route path="/blog_listing" element={<Blog_listing/>} />
			<Route path="/blogs" element={<Blog_listing blogData={blogData} />} />
			<Route path="/contacts" element={<Contacts/>} />
			<Route path="/users" element={<Users blogData={blogData} />} />
			<Route path="/business" element={<Fleet/>} />
			<Route path="/privacy" element={<Privacy/>} />
			<Route path="/getstarted" element={<GetStarted blogData={blogData} />} />
			<Route path="/findev" element={<FindEv />} />
			<Route path="/findmobility" element={<FindMobility />} />
		</Routes>
	  <Footer/>
    </div>

  );
}

export default App;
