Skip to content

Commit ec44f94

Browse files
committed
fix: only add credentials on client-side
resolves nuxt-modules#660
1 parent feea9d0 commit ec44f94

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/runtime/minimal-client.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,17 @@ export function createClient (config: ClientConfig) {
4747
const useCdn = perspective !== 'previewDrafts' && config.useCdn
4848

4949
const fetchOptions: RequestInit = {
50-
credentials: withCredentials ? 'include' : 'omit',
5150
headers: {
5251
...(token ? { Authorization: `Bearer ${token}` } : {}),
5352
Accept: 'application/json',
5453
...(process.server ? { 'accept-encoding': 'gzip, deflate' } : {}),
5554
},
5655
}
5756

57+
if (import.meta.client) {
58+
fetchOptions.credentials = withCredentials ? 'include' : 'omit'
59+
}
60+
5861
return {
5962
clone: () =>
6063
createClient({

0 commit comments

Comments
 (0)