Skip to content

Commit

Permalink
more additions
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuzuri247 committed Dec 22, 2024
1 parent 4272005 commit 7e82e59
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .hintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"development"
]
}
10 changes: 8 additions & 2 deletions app/blogs/[slug]/page.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { client, urlFor } from "../../../lib/sanity";
import Image from "next/image";
import React from "react";
import { PortableText, PortableTextComponents } from "@portabletext/react";
import { PortableText } from "@portabletext/react";
import Link from "next/link";
import { ArrowLeft } from "lucide-react";

Expand All @@ -16,7 +16,10 @@ const getData = async (slug) => {
titleImage
}[0]`;
const data = await client.fetch(query);
return data;
if (!data) {
throw new Error("Blog post not found");
}
return data;
};

const components = {
Expand All @@ -37,6 +40,9 @@ const components = {

const page = async ({ params }) => {
const data = await getData(params.slug);
if (!data) {
return <div>Blog post not found.</div>;
}
return (
<div className="flex flex-col items-center gap-7">
<h1 className="relative flex flex-row items-center">
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
}
],
"types": ["react-reconciler"],
"target": "ES2017"
"target": "ES2017",
"forceConsistentCasingInFileNames": true,
},
"include": [
"**/*.js",
Expand Down

0 comments on commit 7e82e59

Please sign in to comment.