@@ -9,6 +9,7 @@ let clientPretty = true
99let clientService = 'client'
1010let transportEnabled = false
1111let transportEndpoint = '/api/_evlog/ingest'
12+ let transportCredentials : RequestCredentials = 'same-origin'
1213let identityContext : Record < string , unknown > = { }
1314
1415export function setIdentity ( identity : Record < string , unknown > ) : void {
@@ -27,6 +28,7 @@ export function initLog(options: { enabled?: boolean, console?: boolean, pretty?
2728 clientService = options . service ?? 'client'
2829 transportEnabled = options . transport ?. enabled ?? false
2930 transportEndpoint = options . transport ?. endpoint ?? '/api/_evlog/ingest'
31+ transportCredentials = options . transport ?. credentials ?? 'same-origin'
3032}
3133
3234async function sendToServer ( event : Record < string , unknown > ) : Promise < void > {
@@ -38,7 +40,7 @@ async function sendToServer(event: Record<string, unknown>): Promise<void> {
3840 headers : { 'Content-Type' : 'application/json' } ,
3941 body : JSON . stringify ( event ) ,
4042 keepalive : true ,
41- credentials : 'same-origin' ,
43+ credentials : transportCredentials ,
4244 } )
4345 } catch {
4446 // Silently fail - don't break the app
0 commit comments