prettier fixes #16
This commit is contained in:
@@ -1,37 +1,39 @@
|
||||
<script setup lang="ts">
|
||||
const user = useSupabaseUser()
|
||||
const user = useSupabaseUser();
|
||||
const supabase = useSupabaseAuthClient();
|
||||
|
||||
const notifyStore = useNotifyStore();
|
||||
|
||||
const loading = ref(false)
|
||||
const email = ref('')
|
||||
const password = ref('')
|
||||
const confirmPassword = ref('')
|
||||
const signUpOk = ref(false)
|
||||
const loading = ref(false);
|
||||
const email = ref('');
|
||||
const password = ref('');
|
||||
const confirmPassword = ref('');
|
||||
const signUpOk = ref(false);
|
||||
|
||||
const handleStandardSignup = async () => {
|
||||
try {
|
||||
loading.value = true
|
||||
const { data, error } = await supabase.auth.signUp({ email: email.value, password: password.value })
|
||||
loading.value = true;
|
||||
const { data, error } = await supabase.auth.signUp({
|
||||
email: email.value,
|
||||
password: password.value
|
||||
});
|
||||
if (error) {
|
||||
throw error
|
||||
}
|
||||
else {
|
||||
throw error;
|
||||
} else {
|
||||
signUpOk.value = true;
|
||||
}
|
||||
} catch (error) {
|
||||
notifyStore.notify(error, NotificationType.Error);
|
||||
} finally {
|
||||
loading.value = false
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
watchEffect(() => {
|
||||
if (user.value) {
|
||||
navigateTo('/dashboard', { replace: true })
|
||||
navigateTo('/dashboard', { replace: true });
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex flex-col items-center justify-center h-screen bg-gray-100">
|
||||
@@ -40,26 +42,51 @@
|
||||
<form @submit.prevent="handleStandardSignup" class="space-y-4">
|
||||
<div>
|
||||
<label for="email" class="block mb-2 font-bold">Email</label>
|
||||
<input v-model="email" id="email" type="email" class="w-full p-2 border border-gray-400 rounded-md"
|
||||
placeholder="Enter your email" required>
|
||||
<input
|
||||
v-model="email"
|
||||
id="email"
|
||||
type="email"
|
||||
class="w-full p-2 border border-gray-400 rounded-md"
|
||||
placeholder="Enter your email"
|
||||
required />
|
||||
</div>
|
||||
<div>
|
||||
<label for="password" class="block mb-2 font-bold">Password</label>
|
||||
<input v-model="password" id="password" type="password" class="w-full p-2 border border-gray-400 rounded-md"
|
||||
placeholder="Enter your password" required>
|
||||
<input
|
||||
v-model="password"
|
||||
id="password"
|
||||
type="password"
|
||||
class="w-full p-2 border border-gray-400 rounded-md"
|
||||
placeholder="Enter your password"
|
||||
required />
|
||||
</div>
|
||||
<div>
|
||||
<label for="confirmPassword" class="block mb-2 font-bold">Confirm Password</label>
|
||||
<input v-model="confirmPassword" id="confirmPassword" type="password"
|
||||
class="w-full p-2 border border-gray-400 rounded-md" placeholder="Confirm your password" required>
|
||||
<label for="confirmPassword" class="block mb-2 font-bold"
|
||||
>Confirm Password</label
|
||||
>
|
||||
<input
|
||||
v-model="confirmPassword"
|
||||
id="confirmPassword"
|
||||
type="password"
|
||||
class="w-full p-2 border border-gray-400 rounded-md"
|
||||
placeholder="Confirm your password"
|
||||
required />
|
||||
</div>
|
||||
<button :disabled="loading || password === '' || (confirmPassword !== password)" type="submit"
|
||||
class="w-full py-2 text-white bg-indigo-600 rounded-md hover:bg-indigo-700">Sign up</button>
|
||||
|
||||
<p v-if="signUpOk" class="mt-4 text-lg text-center">You have successfully signed up. Please check your email for a link to confirm your email address and proceed.</p>
|
||||
<button
|
||||
:disabled="loading || password === '' || confirmPassword !== password"
|
||||
type="submit"
|
||||
class="w-full py-2 text-white bg-indigo-600 rounded-md hover:bg-indigo-700">
|
||||
Sign up
|
||||
</button>
|
||||
|
||||
<p v-if="signUpOk" class="mt-4 text-lg text-center">
|
||||
You have successfully signed up. Please check your email for a link to
|
||||
confirm your email address and proceed.
|
||||
</p>
|
||||
</form>
|
||||
<p class="text-center">or</p>
|
||||
<button @click="supabase.auth.signInWithOAuth({ provider: 'google' })"
|
||||
<button
|
||||
@click="supabase.auth.signInWithOAuth({ provider: 'google' })"
|
||||
class="w-full py-2 text-white bg-red-600 rounded-md hover:bg-red-700">
|
||||
<span class="flex items-center justify-center space-x-2">
|
||||
<Icon name="fa-brands:google" class="w-5 h-5" />
|
||||
@@ -67,8 +94,9 @@
|
||||
</span>
|
||||
</button>
|
||||
<p class="mt-4 text-xs text-center text-gray-500">
|
||||
By proceeding, I agree to the <NuxtLink to="/privacy">Privacy Statement</NuxtLink> and <NuxtLink to="/terms">Terms
|
||||
of Service</NuxtLink>
|
||||
By proceeding, I agree to the
|
||||
<NuxtLink to="/privacy">Privacy Statement</NuxtLink> and
|
||||
<NuxtLink to="/terms">Terms of Service</NuxtLink>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user