wip: implementando tela de cadastro do usuário
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<div>
|
||||
<NuxtRouteAnnouncer />
|
||||
<NuxtWelcome />
|
||||
</div>
|
||||
<NuxtLayout>
|
||||
<NuxtPage />
|
||||
</NuxtLayout>
|
||||
</template>
|
||||
|
||||
35
app/pages/(auth)/criar-conta/index.vue
Normal file
35
app/pages/(auth)/criar-conta/index.vue
Normal file
@@ -0,0 +1,35 @@
|
||||
<template>
|
||||
<div>
|
||||
<h1>Oooiiii</h1>
|
||||
<label for="email">Email: </label>
|
||||
<input v-model="formData.email" type="text" id="email" name="email" />
|
||||
<label for="senha">Senha: </label>
|
||||
<input v-model="formData.password" type="password" id="senha" name="senha" />
|
||||
<button @click="criarConta">Criar Conta</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
const formData = reactive({
|
||||
email: '',
|
||||
password: ''
|
||||
})
|
||||
|
||||
async function criarConta() {
|
||||
try {
|
||||
(await fetch('/auth/register', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
email: formData.email,
|
||||
password: formData.password
|
||||
})
|
||||
}))()
|
||||
} catch (error) {
|
||||
window.alert('Ocorreu um erro ao criar a conta. Tente novamente mais tarde.', error.statusText)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
5
app/pages/index.vue
Normal file
5
app/pages/index.vue
Normal file
@@ -0,0 +1,5 @@
|
||||
<template>
|
||||
<div>
|
||||
<h1>Welcome to the Home Page</h1>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user