diff --git a/src/components/Form/Select.svelte b/src/components/Form/Select.svelte index e815217d..24bcca5c 100644 --- a/src/components/Form/Select.svelte +++ b/src/components/Form/Select.svelte @@ -2,12 +2,17 @@ export let label; export let value; export let options = []; - export let valueKey = "id"; + export let valueKey = 'id'; + export let isRequired = false; diff --git a/src/routes/signup.svelte b/src/routes/signup.svelte index 9b67d6c7..f4aaa14b 100644 --- a/src/routes/signup.svelte +++ b/src/routes/signup.svelte @@ -2,6 +2,7 @@ import TextField from '../components/Form/TextField.svelte'; import Select from '../components/Form/Select.svelte'; import PrimaryButton from '../components/PrimaryButton/index.svelte'; + import { supabase } from '../utils/functions/supabase'; let email; let userType = 0; @@ -20,9 +21,17 @@ value: 2, }, ]; - - function handleSubmit() { - console.log(`email`, email); + async function handleSubmit() { + try { + loading = true; + const { error } = await supabase.auth.signIn({ email }); + if (error) throw error; + alert('Check your email for the login link!'); + } catch (error) { + alert(error.error_description || error.message); + } finally { + loading = false; + } } @@ -52,6 +61,7 @@ bind:value={userType} options={userTypes} valueKey="value" + isRequired={true} /> @@ -64,6 +74,7 @@ placeholder="Enter your email" onKeyDown={handleSubmit} inputClassName="rounded-md w-full px-2 py-4" + isRequired={true} />

A magic link will be sent to your email, please open the link diff --git a/src/utils/functions/supabase.js b/src/utils/functions/supabase.js index 573ea148..16cb5d7f 100644 --- a/src/utils/functions/supabase.js +++ b/src/utils/functions/supabase.js @@ -1,6 +1,7 @@ import { createClient } from '@supabase/supabase-js'; -import config from '../../config'; +import getConfig from '../../config'; +const config = getConfig(); export const supabase = createClient( config.supabaseConfig.url,