fix: fetch was not using rest requests
This commit is contained in:
@@ -16,7 +16,12 @@ export function BlogViewer() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!slug) return;
|
||||
fetch(`${API_URL}/blogs/${slug}`)
|
||||
fetch(`${API_URL}/blogs/${slug}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then((data: Blog) => setBlog(data))
|
||||
.catch((err) => console.error(err));
|
||||
|
||||
Reference in New Issue
Block a user