tRPCttRPC
Powered by
jasonnpwJ
tRPC•2y ago•
1 reply
jasonnpw

Create user on the function mutate, with TRPC and Payload

Hi everyone, I have faced issues with create user on the function mutate, with TRPC, I cant trace and debug it. TRPC is connected based on the log here as it return some testing value. Please help me. I been stucking for almost a week

page.tsx
"use client";

import { Icons } from "@/components/Icons";
import { Button, buttonVariants } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { cn } from "@/lib/utils";
import {
AuthCredentialsValidator,
TAuthCredentialsValidator,
} from "@/lib/validators/account-credentials-validator";
import { trpc } from "@/trpc/client";
import { zodResolver } from "@hookform/resolvers/zod";
import { ArrowRight } from "lucide-react";
import Link from "next/link";
import { useForm } from "react-hook-form";

const page = () => {
const {
register,
handleSubmit,
formState: { errors },
} = useForm<TAuthCredentialsValidator>({
resolver: zodResolver(AuthCredentialsValidator),
});

const { data } = trpc.anyApiRoute.useQuery();

const { mutate, isLoading } = trpc.auth.createPayloadUser.useMutation({});

const onSubmit = ({ email, password }: TAuthCredentialsValidator) => {
mutate({ email, password });
};
image.png
image.png
image.png
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

query and mutate promise on next
TuxerTTuxer / ❓-help
4y ago
tRPC mutate call firing two requests with custom link
kazamyrKkazamyr / ❓-help
3y ago
Use TRPC function inside of a TRPC function
santiSsanti / ❓-help
3y ago
Correct types and payload for the applyWSSHandler with createContext
renardeinsRrenardeins / ❓-help
2y ago