feat(#9): Add sign up

This commit is contained in:
Josh Creek
2024-04-06 21:10:37 +01:00
parent b7996e50a6
commit 6cfa2bd6d7
10 changed files with 327 additions and 8 deletions
+33
View File
@@ -0,0 +1,33 @@
<script lang="ts">
let email = '';
let password = '';
// Access the supabase client from the layout data
export let supabase: any;
async function signUpNewUser() {
try {
const { data, error } = await supabase.auth.signUp({
email: email,
password: password,
options: {
// Redirect URL after successful sign-up
redirectTo: '/welcome'
}
});
if (error) {
throw error;
}
// Handle success (optional)
} catch (error) {
console.error('Sign up error:', error.message);
// Handle error
}
}
</script>
<input type="email" bind:value={email} placeholder="Email" />
<input type="password" bind:value={password} placeholder="Password" />
<button on:click={signUpNewUser}>Sign Up</button>