add addrainfall on home

This commit is contained in:
Romulus21
2024-04-22 22:23:59 +02:00
parent 2f260555cb
commit 2f2077497d
4 changed files with 35 additions and 26 deletions

View File

@@ -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,
}