Skip to content

Commit 3434913

Browse files
committed
fix: type errors
1 parent a304278 commit 3434913

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

lib/wordpress.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import querystring from "query-string";
66
import { revalidateTag } from "next/cache";
7-
import { headers } from "next/headers";
87

98
import type {
109
Post,
@@ -28,7 +27,6 @@ interface FetchOptions {
2827
revalidate?: number | false;
2928
tags?: string[];
3029
};
31-
headers?: HeadersInit;
3230
}
3331

3432
function getUrl(path: string, query?: Record<string, any>) {
@@ -42,10 +40,6 @@ const defaultFetchOptions: FetchOptions = {
4240
tags: ["wordpress"],
4341
revalidate: 3600, // Revalidate every hour by default
4442
},
45-
headers: {
46-
Accept: "application/json",
47-
"Content-Type": "application/json",
48-
},
4943
};
5044

5145
// Error handling utility
@@ -61,16 +55,13 @@ async function wordpressFetch<T>(
6155
url: string,
6256
options: FetchOptions = {}
6357
): Promise<T> {
64-
const headersList = await headers();
65-
const userAgent = headersList.get("user-agent") || "Next.js WordPress Client";
58+
const userAgent = "Next.js WordPress Client";
6659

6760
const response = await fetch(url, {
6861
...defaultFetchOptions,
6962
...options,
7063
headers: {
71-
...defaultFetchOptions.headers,
7264
"User-Agent": userAgent,
73-
...options.headers,
7465
},
7566
});
7667

0 commit comments

Comments
 (0)