diff --git a/app/pages/(auth)/criar-conta/index.vue b/app/pages/(auth)/criar-conta/index.vue index 750230f..f6a9320 100644 --- a/app/pages/(auth)/criar-conta/index.vue +++ b/app/pages/(auth)/criar-conta/index.vue @@ -42,8 +42,8 @@ Email - @@ -55,17 +55,18 @@ Senha - - @@ -79,6 +80,8 @@ import { z } from 'zod' const { $toast } = useNuxtApp() +const isLoading = ref(false) + const toStr = (val) => (val == null ? '' : val) const schema = toTypedSchema( @@ -89,6 +92,7 @@ const schema = toTypedSchema( ) async function criarConta({ email, password }) { + isLoading.value = true try { const res = await fetch('/auth/register', { method: 'POST', @@ -105,6 +109,8 @@ async function criarConta({ email, password }) { $toast.success('Conta criada com sucesso!') } catch { $toast.error('Erro ao criar conta. Tente novamente.') + } finally { + isLoading.value = false } }