chingu-voyages / v48-tier3-team-21

A virtual Dino world, where you can explore various types of dinosaurs from different eras and regions. This project is mainly a Next.js build | Voyage-48 | Tier 3 | Team 21 | https://chingu.io | Twitter: https://twitter.com/ChinguCollabs
https://digging-into-dinosaurs.vercel.app/?decade=all-dinos
1 stars 2 forks source link

updated /app/lib/utils.ts for the dinonews_api #40

Closed Jaweki closed 6 months ago

Jaweki commented 6 months ago
  1. moved the url related to news_api from the .env.local into fetchLatestNews() function;
  2. added a function getPastDate() used to calculate the past 29 days. This is important as news api free tier only allows news from 30 days ago.
  3. modified the NewsItem component( by adding a optional chaining), to skip render if there is null data from the function fetchLatestNews()