Skip to content

Commit

Permalink
trypear#23 - Add SignUpWithPasswordCredentials type for signup function
Browse files Browse the repository at this point in the history
  • Loading branch information
Ellahinator committed Jun 7, 2024
1 parent 8cf7142 commit 8bd7696
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/(auth)/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { revalidatePath } from "next/cache";
import { redirect } from "next/navigation";

import { createClient } from "@/utils/supabase/server";
import { SignUpWithPasswordCredentials } from "@supabase/supabase-js";
export async function signin(formData: FormData) {
const supabase = createClient();

Expand All @@ -28,11 +29,15 @@ export async function signup(formData: FormData) {
const supabase = createClient();
// type-casting here for convenience
// in practice, you should validate your inputs
const data = {
const data: SignUpWithPasswordCredentials = {
email: formData.get("email") as string,
password: formData.get("password") as string,
fullName: formData.get("full-name") as string,
// companyName: formData.get("company-name") as string,
options: {
data: {
full_name: formData.get("full-name") as string,
company_name: formData.get("company-name") as string,
}
}
};

const { error } = await supabase.auth.signUp(data);
Expand Down

0 comments on commit 8bd7696

Please sign in to comment.