sample toast integration

This commit is contained in:
2021-02-27 18:28:32 +01:00
parent b7f15f4d68
commit ff89071156
3 changed files with 13 additions and 7 deletions

View File

@@ -182,11 +182,13 @@ import axios from "redaxios";
import Toastify from "toastify-js";
import isEmail from 'validator/es/lib/isEmail';
import isMobilePhone from 'validator/es/lib/isMobilePhone';
import { useToast } from "vue-toastification";
let userdetails = ref({ firstname: "", lastname: "", middlename: "", mail: "", phone: "" });
let phone_valid = ref(!userdetails.value.phone.trim() || isMobilePhone(userdetails.value.phone));
let provide_address = ref(false);
let agb_accepted = ref(false);
const toast = useToast();
function login() {
userdetails = userdetails.value;
if (userdetails.phone === "" || isMobilePhone(userdetails.phone)) {
@@ -201,20 +203,21 @@ function login() {
if (isMobilePhone(userdetails.phone)) {
postdata.phone = userdetails.phone;
}
axios.post('https://dev.lauf-fuer-kaya.de/api/runners/register',)
.then(function(response) {
toast("registration in progress...");
axios.post('https://dev.lauf-fuer-kaya.de/api/runners/register', postdata)
.then((response) => {
response = response.data;
const token = response.token;
const userid = JSON.parse(atob(token.split(".")[1])).id;
console.log({ token });
console.log({ userid });
//
toast.success("You have been registered!");
})
.catch(function(error) {
.catch((error) => {
console.log(error);
});
}
}
// console.log(agb_accepted.value);
// alert("AGB was " + (agb_accepted.value === true ? "accepted" : "not accepted"));
}
</script>