auth, trips and join trips

This commit is contained in:
2026-04-16 14:51:54 +07:00
parent de0d1c5413
commit 237caad488
49 changed files with 11343 additions and 334 deletions
+29
View File
@@ -0,0 +1,29 @@
"use server";
import { registerSchema } from "./schemas";
import { authService } from "@/server/services/auth.service";
export async function registerAction(formData: FormData) {
const raw = {
name: formData.get("name") as string,
email: formData.get("email") as string,
password: formData.get("password") as string,
confirmPassword: formData.get("confirmPassword") as string,
};
const result = registerSchema.safeParse(raw);
if (!result.success) {
return { error: result.error.issues[0].message };
}
try {
await authService.register({
name: result.data.name,
email: result.data.email,
password: result.data.password,
});
return { success: true };
} catch (err) {
return { error: (err as Error).message };
}
}