Add login view
This commit is contained in:
parent
8b70374de6
commit
3376253792
4 changed files with 24 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<form class="box" @submit.prevent="doSignup">
|
||||
<form class="box" @submit.prevent="doAction">
|
||||
<b-field label="E-Mail-Adresse">
|
||||
<b-input type="email" v-model="user.email" />
|
||||
</b-field>
|
||||
|
@ -17,22 +17,28 @@
|
|||
type="is-primary"
|
||||
style="margin-left: auto; margin-right: 0; order: 10"
|
||||
>
|
||||
Konto anlegen
|
||||
{{ mode === "login" ? "Anmelden" : "Konto anlegen" }}
|
||||
</b-button>
|
||||
</div>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from "vue-property-decorator";
|
||||
import { Component, Prop, Vue } from "vue-property-decorator";
|
||||
import { User } from "@/api";
|
||||
|
||||
@Component
|
||||
export default class LoginForm extends Vue {
|
||||
private user = new User("", "");
|
||||
@Prop() private user!: User;
|
||||
|
||||
private async doSignup() {
|
||||
await this.user.signup();
|
||||
private mode: "login" | "signup" = "login";
|
||||
|
||||
private async doAction() {
|
||||
if (this.mode === "login") {
|
||||
await this.user.login();
|
||||
} else {
|
||||
await this.user.signup();
|
||||
}
|
||||
// TODO: error handling, show confirmation page
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue