Skip to content

Commit

Permalink
Updated page.tsx in '/news/[category]' route to use categories from c…
Browse files Browse the repository at this point in the history
…onstants.ts.
  • Loading branch information
dhawal-793 committed May 18, 2023
1 parent 47d137a commit 38b3eae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/news/[category]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import NewsList from "@/components/NewsList"
import { categories } from "@/constants"
import fetchNews from "@/lib/fetchNews"
import { notFound } from "next/navigation"

Expand All @@ -7,7 +8,6 @@ type Props = {
}

const NewsByCategory = async ({ params: { category } }: Props) => {
const categories = ["general", "buisness", "entertainment", "health", "science", "sports", "technology"];
if (!categories.includes(category)) { return notFound() }
const news = await fetchNews(category)
return (
Expand Down

0 comments on commit 38b3eae

Please sign in to comment.