fix(sdk): incorrect fetch initialization on cloudflare (#14009)
Fixes ``` TypeError: Illegal invocation: function called with incorrect this reference. ``` error on Cloudflare - https://github.com/payloadcms/payload/pull/9463#discussion_r2230376819
This commit is contained in:
@@ -130,7 +130,7 @@ export class PayloadSDK<T extends PayloadGeneratedTypes = PayloadGeneratedTypes>
|
||||
fetch: typeof fetch
|
||||
constructor(args: Args) {
|
||||
this.baseURL = args.baseURL
|
||||
this.fetch = args.fetch ?? globalThis.fetch
|
||||
this.fetch = args.fetch ?? globalThis.fetch.bind(globalThis)
|
||||
this.baseInit = args.baseInit ?? {}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user