From 467933299ef069c6bef58a0da44db9d2cfd21d12 Mon Sep 17 00:00:00 2001 From: Marco Pedone Date: Mon, 1 Sep 2025 10:15:15 +0200 Subject: [PATCH] feat: add test page with buttons for logging and server mutation --- apps/infoalloggi/src/pages/test.tsx | 37 +++++++++++++++++++ .../src/server/api/routers/test.ts | 12 +++++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 apps/infoalloggi/src/pages/test.tsx diff --git a/apps/infoalloggi/src/pages/test.tsx b/apps/infoalloggi/src/pages/test.tsx new file mode 100644 index 0000000..8bdefc7 --- /dev/null +++ b/apps/infoalloggi/src/pages/test.tsx @@ -0,0 +1,37 @@ +import type { NextPage } from "next"; +import { Button } from "~/components/ui/button"; +import { api } from "~/utils/api"; + +const Test: NextPage = () => { + const { mutate } = api.test.testErr.useMutation(); + return ( +
+ + + + + +
+ ); +}; +export default Test; diff --git a/apps/infoalloggi/src/server/api/routers/test.ts b/apps/infoalloggi/src/server/api/routers/test.ts index 1cd5cfa..e7aefd1 100644 --- a/apps/infoalloggi/src/server/api/routers/test.ts +++ b/apps/infoalloggi/src/server/api/routers/test.ts @@ -1,9 +1,19 @@ -import { createTRPCRouter, protectedApiProcedure } from "~/server/api/trpc"; +import { + createTRPCRouter, + protectedApiProcedure, + publicProcedure, +} from "~/server/api/trpc"; export const testRouter = createTRPCRouter({ testApi: protectedApiProcedure.query(async () => { return "Hello World!"; }), + testErr: publicProcedure.mutation(async () => { + console.log("test console.log"); + console.info("test console.info"); + console.error("test console.error"); + throw new Error("This is a test error"); + }), /* PROTECTED API CALL EXAMPLE