"use server";
import { authClient } from "@/lib/auth-client";
import type { LoginRegisterSchema } from "@/schemas";
import type * as z from "zod/v4";
export async function loginAction(values: z.infer<typeof LoginRegisterSchema>) {
console.log("values: ", values);
const { error, data } = await authClient.signIn.magicLink({
email: values.email,
callbackURL: "/dashboard",
});
console.log("loginAction: ", { error, data });
if (error) {
return {
success: false,
message: "An error occured while sending the email verification !",
};
}
return { success: true, message: "Email sent !" };
}
"use server";
import { authClient } from "@/lib/auth-client";
import type { LoginRegisterSchema } from "@/schemas";
import type * as z from "zod/v4";
export async function loginAction(values: z.infer<typeof LoginRegisterSchema>) {
console.log("values: ", values);
const { error, data } = await authClient.signIn.magicLink({
email: values.email,
callbackURL: "/dashboard",
});
console.log("loginAction: ", { error, data });
if (error) {
return {
success: false,
message: "An error occured while sending the email verification !",
};
}
return { success: true, message: "Email sent !" };
}