feat: fix TS types on auth.ts

This commit is contained in:
Pablo Lara
2024-09-02 07:33:57 +02:00
parent c281f85742
commit 0acfb6040e
+8 -5
View File
@@ -1,19 +1,22 @@
"use server";
import { AuthError } from "next-auth";
import { z } from "zod";
import { signIn, signOut } from "@/auth.config";
// import { authFormSchema } from "@/types";
import { authFormSchema } from "@/types";
// const formSchema = authFormSchema("sign-in");
const formSchemaSignIn = authFormSchema("sign-in");
const defaultValues = {
const defaultValues: z.infer<typeof formSchemaSignIn> = {
email: "",
password: "",
};
// Fix TS types.
export async function authenticate(prevState: any, formData: any) {
export async function authenticate(
prevState: unknown,
formData: z.infer<typeof formSchemaSignIn>,
) {
try {
await new Promise((resolve) => setTimeout(resolve, 2000));
await signIn("credentials", {