Example project: Use POST for the test event
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { client } from "@/trigger";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
export async function POST(request: Request) {
|
||||
const event = await client.sendEvent({
|
||||
name: "test-event",
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@ export function SendTestEventButton() {
|
||||
const router = useRouter();
|
||||
const mutation = useMutation({
|
||||
mutationFn: async () => {
|
||||
const response = await fetch("/api/send-test-event");
|
||||
const response = await fetch("/api/send-test-event", { method: "POST" });
|
||||
const data = await response.json();
|
||||
console.log("event", data);
|
||||
router.push(`/events/${data.id}`);
|
||||
|
||||
Reference in New Issue
Block a user