add flatastic api
This commit is contained in:
21
src/components/Flatastic/Flatastic.tsx
Normal file
21
src/components/Flatastic/Flatastic.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import fetchFlatasticChores from "@/store/thunks/fetchFlatasticChores";
|
||||
import { useEffect } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { type AppDispatch } from "@/store/index";
|
||||
|
||||
export default function Flatastic() {
|
||||
const dispatch = useDispatch<AppDispatch>();
|
||||
useEffect(() => {
|
||||
const intervalID = setInterval(() => {
|
||||
dispatch(fetchFlatasticChores());
|
||||
}, 60000); // Fetch every 60 seconds
|
||||
|
||||
return () => clearInterval(intervalID);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<p>
|
||||
Flatastic API Key: {import.meta.env.VITE_FLATTASTIC_API_KEY || "Not set"}
|
||||
</p>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user