Skip to content

Commit 1b52091

Browse files
committed
feat: next version up
1 parent 7564601 commit 1b52091

File tree

3 files changed

+56
-109
lines changed

3 files changed

+56
-109
lines changed

packages/velog-web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"html-react-parser": "^5.0.6",
4444
"inquirer": "^9.2.7",
4545
"nanoid": "^4.0.2",
46-
"next": "^14.0.3",
46+
"next": "^14.1.0",
4747
"postcss-flexbugs-fixes": "^5.0.2",
4848
"postcss-preset-env": "^8.5.0",
4949
"prismjs": "^1.29.0",

packages/velog-web/src/lib/graphqlFetch.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,20 @@ export default async function graphqlFetch<T>({
1616
targetUrl = `${url}?${queryString}`
1717
}
1818

19+
const defaultHeaders = {
20+
'Content-Type': 'application/json',
21+
Accept: 'application/json',
22+
}
23+
24+
const combinedHeaders = new Headers({
25+
...defaultHeaders,
26+
...headers,
27+
})
28+
1929
const res = await fetch(targetUrl, {
2030
method,
2131
body: method.toUpperCase() === 'POST' ? JSON.stringify(body) : undefined,
22-
headers: new Headers({
23-
'Content-Type': 'application/json',
24-
Accept: 'application/json',
25-
...headers,
26-
}),
32+
headers: combinedHeaders,
2733
credentials: 'include',
2834
next,
2935
cache,
@@ -42,8 +48,8 @@ export default async function graphqlFetch<T>({
4248
console.log('body', body)
4349
}
4450

45-
console.log(res)
4651
if (process.env.NODE_ENV === 'development') {
52+
console.log('fetch failed res:', res)
4753
}
4854

4955
const message = {
@@ -52,7 +58,7 @@ export default async function graphqlFetch<T>({
5258
statusText: res.statusText,
5359
}
5460

55-
throw new Error(JSON.stringify(message))
61+
throw new Error(message as any)
5662
}
5763

5864
const json = await res.json()

pnpm-lock.yaml

Lines changed: 42 additions & 101 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)