Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
977 B
1
Indexable
Never
import React from 'react';
import VisitorChart from '../../components/charts/VisitorChart';
import TMSChart from '../../components/charts/TMSChart';
import AverageTimeChart from '../../components/charts/AverageTimeChart';
import ChartLayout from '../../components/ChartLayout';
import RVRChart from '../../components/charts/RVRChart';
import {getWeather} from '../../services/darksky.service'
const Dashboard = () => {
  const [weathers, setWeathers] = React.useState([])
  const [weatherParams, setWeatherParams] = React.useState({
    date_start: 1648761765,
    date_end: 1650662565
  })
  const getWeathers = async () => {
   try{
    const {data} = await getWeather(weatherParams)
    setWeathers(data)
   }catch(e){

   }
  }
  
  React.useEffect(()=>{
    getWeathers()
  },[])

  return (
    <ChartLayout>
      <VisitorChart weathers={weathers} />
      <TMSChart />
      <AverageTimeChart />
      <RVRChart />
    </ChartLayout>
  );
};

export default Dashboard;