Sherlock / components / signUp.tsx
signUp.tsx
Raw
import { Auth } from "aws-amplify";

type SignUpParameters = {
    username:string,
    email: string;
    password: string;
    displayName: string;
};

export async function signUp({username,email,password,displayName,}: SignUpParameters) {
    try {
        const { user } = await Auth.signUp({
            username,
            password,
            attributes: {
                email,
                displayName,
            },
        autoSignIn: {
            // optional - enables auto sign in after user is confirmed
            enabled: true,
        },
        });
        console.log(user);
    } catch (error) {
        console.log("error signing up:", error);
    }
}