Avisos registro
This commit is contained in:
@@ -103,10 +103,16 @@
|
||||
<script setup>
|
||||
import { ref, computed } from "vue";
|
||||
import { useListaStore } from "../stores/lista.js";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useRouter } from "vue-router";
|
||||
|
||||
const listaStore = useListaStore();
|
||||
const $q = useQuasar();
|
||||
const $router = useRouter();
|
||||
|
||||
const email = ref("");
|
||||
const password = ref("");
|
||||
const username = ref(""); //No exista en la bd, tamaño mínimo
|
||||
const username = ref("");
|
||||
const confirmpassword = ref("");
|
||||
const nombre = ref("");
|
||||
const usuarios = ref([]);
|
||||
@@ -115,6 +121,7 @@ const recibeDatos = () => {
|
||||
listaStore.getUsers().then(function (item) {
|
||||
usuarios.value = item;
|
||||
});
|
||||
console.log(usuarios.value);
|
||||
};
|
||||
const comprobarUsername = computed(() => {
|
||||
let filtro = usuarios.value?.filter(
|
||||
@@ -170,7 +177,14 @@ const registrar = () => {
|
||||
passwordConfirm: confirmpassword.value,
|
||||
name: nombre.value,
|
||||
};
|
||||
listaStore.register(data);
|
||||
listaStore.register(data).then((r) => {
|
||||
$q.dialog({
|
||||
title: "Aviso",
|
||||
message: "Se le ha enviado un correo electrónico que debe verificar",
|
||||
}).onOk(() => {
|
||||
$router.push("/");
|
||||
});
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -44,20 +44,13 @@ export const useListaStore = defineStore("lista", () => {
|
||||
sort: "-created",
|
||||
});
|
||||
}
|
||||
|
||||
async function register(data) {
|
||||
console.log(data);
|
||||
const record = await pb
|
||||
.collection("users")
|
||||
.create(data)
|
||||
.then((r) => {
|
||||
pb.collection("users")
|
||||
.requestVerification(data.email)
|
||||
.then((r) => {
|
||||
console.log("email enviado");
|
||||
this.router.push("/login");
|
||||
});
|
||||
console.log("Correcto");
|
||||
pb.collection("users").requestVerification(data.email);
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
|
||||
Reference in New Issue
Block a user