File tree Expand file tree Collapse file tree 1 file changed +1
-23
lines changed Expand file tree Collapse file tree 1 file changed +1
-23
lines changed Original file line number Diff line number Diff line change 11export async function sendEvent ( event : Record < string , any > ) : Promise < void > {
2- if (
3- typeof GRAPH_JSON_API_KEY === "undefined" ||
4- typeof GRAPH_JSON_COLLECTION === "undefined"
5- ) {
6- return ;
7- }
8-
9- const payload = {
10- api_key : GRAPH_JSON_API_KEY ,
11- collection : GRAPH_JSON_COLLECTION ,
12- json : JSON . stringify ( event ) ,
13- timestamp : Math . floor ( new Date ( ) . getTime ( ) / 1000 ) ,
14- } ;
15-
16- console . log (
17- `[GraphJSON] Sending event: ${ JSON . stringify ( payload , graphJsonReplacer ) } `
18- ) ;
19-
20- await fetch ( "https://api.graphjson.com/api/log" , {
21- method : "POST" ,
22- headers : { "Content-Type" : "application/json" } ,
23- body : JSON . stringify ( payload ) ,
24- } ) ;
2+ return ;
253}
264
275function graphJsonReplacer ( key : string , value : any ) : any {
You can’t perform that action at this time.
0 commit comments