add addrainfall on home
This commit is contained in:
@@ -1,24 +1,17 @@
|
||||
import React, {useState, useEffect} from "react"
|
||||
import React, {FC, useState, useEffect} from "react"
|
||||
import Card from "../Card"
|
||||
import useAxiosTools from "../../hooks/AxiosTools"
|
||||
import {AxiosError} from "axios"
|
||||
import {monthlyRainfall} from "../../types"
|
||||
|
||||
const YearRainfall = () => {
|
||||
const YearRainfall: FC<YearRainfallProps> = ({loadedAt}) => {
|
||||
|
||||
const {errorCatch, errorLabel, setError, axiosGet} = useAxiosTools()
|
||||
const [data, setData] = useState<monthlyRainfall[]>([])
|
||||
const months = Array(13)
|
||||
.reduce((result, item, index) => {
|
||||
const date = new Date()
|
||||
console.log(item, index, date)
|
||||
return item
|
||||
}, [])
|
||||
console.log(months)
|
||||
|
||||
useEffect(() => {
|
||||
fetchData()
|
||||
}, [])
|
||||
}, [loadedAt])
|
||||
|
||||
const fetchData = async () => {
|
||||
try {
|
||||
@@ -61,3 +54,7 @@ const YearRainfall = () => {
|
||||
}
|
||||
|
||||
export default YearRainfall
|
||||
|
||||
interface YearRainfallProps {
|
||||
loadedAt: Date,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user