sendEvent.ts raw

   1  import { request } from "src/utils/request";
   2  
   3  export async function sendEvent(
   4    name: string,
   5    properties?: Record<string, unknown>
   6  ) {
   7    try {
   8      await request(`/api/event`, {
   9        method: "POST",
  10        headers: { "Content-Type": "application/json" },
  11        body: JSON.stringify({ event: name, properties }),
  12      });
  13    } catch (error) {
  14      console.error(error);
  15    }
  16  }
  17