I've followed the docs on how to implement magic link, however i feel there is a few things missing from the example, email validation and error handling. Can someone please guide me in the right direction with the syntax and or structure of how to implement this?
const [email, setEmail] = useState("")<Input // shadcn component id="email" type="email" // this doesnt help with validation because using onClick not submission name="email" placeholder="Enter email" autoFocus required onChange={(e) => setEmail(e.target.value)} /><Button onClick={async () => { await authClient.signIn.magicLink({ // how can i add error handling? do i wrap in try-catch? email: email, callbackURL: "/dashboard" })}}>Submit</Button
const [email, setEmail] = useState("")<Input // shadcn component id="email" type="email" // this doesnt help with validation because using onClick not submission name="email" placeholder="Enter email" autoFocus required onChange={(e) => setEmail(e.target.value)} /><Button onClick={async () => { await authClient.signIn.magicLink({ // how can i add error handling? do i wrap in try-catch? email: email, callbackURL: "/dashboard" })}}>Submit</Button