Example project: Use POST for the test event

This commit is contained in:
Matt Aitken
2023-07-26 18:52:07 +01:00
parent 6c96b331dd
commit 1bd755b628
2 changed files with 2 additions and 2 deletions
@@ -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}`);