You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some hints from AI; To include the credentials: 'include' option in your fetcher instance, you need to modify the fetchy function to accept and pass through the credentials option from the FetcherOptions to the fetch call. This involves updating the fetchy function to include credentials in the init object passed to the fetch call.
exportinterfaceFetcherOptions{base?: string;autoParse?: boolean;transformRequest?: (request: RequestLike)=>RequestLike|Promise<RequestLike>;handleResponse?: (response: Response)=>any;fetch?: typeoffetch;headers?: Record<string,string>;credentials?: RequestCredentials;// Add this line}constfetchy=(options: FetchyOptions): FetchyFunction=>async(url_or_path: string,payload?: RequestPayload,fetchOptions?: FetchOptions)=>{// Existing code...
let req: RequestLike={url: full_url,
method,body: stringify ? JSON.stringify(payload) : (payloadasPassThroughPayload),
...fetchOptions,headers: {
...jsonHeaders,
...options?.headers,
...fetchOptions?.headers,},credentials: options.credentials,// Add this line to include credentials};// Existing code...const{ url, ...init}=req;constf=options?.fetch||fetch;leterror;returnf(url,init).then(async(response)=>{// Existing code...});};exportfunctionfetcher(fetcherOptions?: FetcherOptions){return<FetcherType>newProxy({base: '',autoParse: true,
...fetcherOptions,},{get: (obj,prop: string)=>obj[prop]??fetchy({method: prop, ...obj}),});}
I was trying to pass
{ credentials: 'include' }
for CORS stuff but it seems like these aren't passed when declaring a fetcher instance...being able to do this would be great:
The text was updated successfully, but these errors were encountered: