Skip to content

Commit

Permalink
Refactor Heart component to use console.debug and fetchHeart function
Browse files Browse the repository at this point in the history
  • Loading branch information
walnuts1018 committed Jan 19, 2024
1 parent 18c85a9 commit 292f4bc
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/app/components/Heart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,12 @@ export default function Heart() {
async function fetchHeart() {
const res = await fetch('/api/heart')
const data: HeartRate = await res.json()
console.log(data)
console.debug(data)
setHeartRate(data.heart)
}
fetchHeart()
setInterval(async () => {
const res = await fetch('/api/heart')
const data: HeartRate = await res.json()
console.log(data)
setHeartRate(data.heart)
fetchHeart()
}, fetchInterval)
return () => {
clearInterval(fetchInterval)
Expand Down

0 comments on commit 292f4bc

Please sign in to comment.