Skip to content

Commit 93b8bb8

Browse files
committed
fix(useStrapiClient): prevent cookie
Fixes #366, fixes #364, fixes #138, fixes #229
1 parent 43fa3c7 commit 93b8bb8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/runtime/composables/useStrapiClient.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
import type { FetchError, FetchOptions } from 'ofetch'
22
import { stringify } from 'qs'
3+
import dns from 'dns'
34
import type { Strapi4Error } from '../types/v4'
45
import type { Strapi3Error } from '../types/v3'
56
import { useStrapiUrl } from './useStrapiUrl'
67
import { useStrapiVersion } from './useStrapiVersion'
78
import { useStrapiToken } from './useStrapiToken'
89
import { useNuxtApp } from '#imports'
910

11+
// Fixes `ECONNREFUSED` on Node 18: https://github.com/node-fetch/node-fetch/issues/1624#issuecomment-1407717012
12+
if (process.server && process.dev) {
13+
dns.setDefaultResultOrder('ipv4first')
14+
}
15+
1016
const defaultErrors = (err: FetchError) => ({
1117
v4: {
1218
error: {

0 commit comments

Comments
 (0)