working path params for org registration

ref #15
This commit is contained in:
Philipp Dormann 2021-03-25 19:36:31 +01:00
parent 18d1ddacf7
commit 79d8545ed6
2 changed files with 9 additions and 5 deletions

View File

@ -6,6 +6,10 @@
class="sm:text-3xl text-2xl font-medium title-font mb-4 text-center"
>Lauf für Kaya! - {{ $t('registrieren') }}</h1>
<p class="mx-auto leading-relaxed text-base text-center">{{ $t('register.register_now') }}</p>
<p
v-if="state.org_name !== ''"
class="mx-auto leading-relaxed text-base text-center"
>Organization: {{ state.org_name }}</p>
<div class="mt-4">
<label for="first_name" class="block font-medium">
{{ $t('vorname') }}
@ -233,6 +237,7 @@ if (props.token) {
axios.get(`${config.baseurl}api/organizations/selfservice/${props.token}`)
.then(({ data }) => {
console.log(data);
state.org_name = data.name;
})
.catch((error) => {
console.log(error);
@ -242,9 +247,9 @@ if (props.token) {
let userdetails = ref({ firstname: "", lastname: "", middlename: "", mail: "", phone: "", address: { street: "", address2: "", city: "", zipcode: "" } });
let provide_address = ref(false);
let agb_accepted = ref(false);
let firma = ref("");
//
const state = reactive({
org_name: "",
submit_enabled: computed(() => agb_accepted.value === true && (isMobilePhone(userdetails.value.phone) || !userdetails.value.phone.trim()) && isEmail(userdetails.value.mail)
&& userdetails.value.firstname
&& userdetails.value.lastname && (provide_address.value === false || provide_address.value === true && (userdetails.value.address.street.trim() && userdetails.value.address.city.trim() && isPostalCode(userdetails.value.address.zipcode, "DE"))))
@ -275,9 +280,8 @@ function login() {
}
toast("registration in progress...");
axios.post(`${config.baseurl}api/runners/register`, postdata)
.then((response) => {
response = response.data;
const token = response.token;
.then(({ data }) => {
const token = data.token;
const userid = JSON.parse(atob(token.split(".")[1])).id;
console.log({ token });
console.log({ userid });

View File

@ -25,7 +25,7 @@ const EnvError = import('./components/EnvError.vue');
const Home = import('./components/Home.vue');
const Imprint = import('./components/Imprint.vue');
const Privacy = import('./components/Privacy.vue');
const Register = import('./components/Register.vue');
const Register = () => import('./components/Register.vue');
const Profile = () => import('./components/Profile.vue');
//
let routes = [ { path: '/:pathMatch(.*)*', component: EnvError } ];