Currently, I am utilizing the NextJS app router.
I am attempting to invoke a rather straightforward route:
import { z } from "zod";
import { createTRPCRouter, publicProcedure } from "~/server/api/trpc";
// document sending user email to waitlist database
export const createEmailRouter = createTRPCRouter({
postEmail: publicProcedure
.input(
z.object({
email: z.string().email(),
}),
)
.mutation(async ({ input }) => {
console.log("email", input.email);
return {
email: input.email,
};
}),
});
Then in the root.ts file, I insert the route:
export const appRouter = createTRPCRouter({
post: postRouter,
storeEmail: createEmailRouter,
});
However, whenever I attempt to utilize the .useMutation for this route on my page, I continually encounter the following error: https://i.sstatic.net/pxYaL.png
Do you have any ideas on how to resolve this issue? I have been unable to find any relevant information online.
Thank you!