Update register to tailwindcss
This commit is contained in:
parent
4019656e4d
commit
4085868cd7
@ -26,18 +26,12 @@ function formSubmit(e: MouseEvent) {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<input
|
<input type="text" v-model="login.user"
|
||||||
type="text"
|
|
||||||
v-model="login.user"
|
|
||||||
placeholder="Username"
|
placeholder="Username"
|
||||||
class="border-2 border-black rounded-lg block px-2 my-2 w-48"
|
class="border-2 border-black rounded-lg block px-2 my-2 w-48" />
|
||||||
/>
|
<input type="password" v-model="login.password"
|
||||||
<input
|
|
||||||
type="password"
|
|
||||||
v-model="login.password"
|
|
||||||
placeholder="Password"
|
placeholder="Password"
|
||||||
class="border-2 border-black rounded-lg block px-2 my-2 w-48"
|
class="border-2 border-black rounded-lg block px-2 my-2 w-48" />
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div>{{ error }}</div>
|
<div>{{ error }}</div>
|
||||||
<button type="submit" @click="formSubmit" class="bg-blue-300 rounded-lg p-2 w-48">Login</button>
|
<button type="submit" @click="formSubmit" class="bg-blue-300 rounded-lg p-2 w-48">Login</button>
|
||||||
|
@ -1,16 +1,23 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from 'vue';
|
import { onMounted, ref } from "vue";
|
||||||
import { useSessionStore } from '../stores/session';
|
import { useRouter } from "vue-router";
|
||||||
|
import { useSessionStore } from "../stores/session";
|
||||||
|
|
||||||
const error = ref("");
|
const error = ref("");
|
||||||
const login = ref({ email: "", password: "", name: "" });
|
const login = ref({ email: "", password: "", name: "" });
|
||||||
const showPassword = ref(false);
|
|
||||||
|
|
||||||
function formSubmit(e: FormDataEvent) {
|
onMounted(() => {
|
||||||
|
useSessionStore().setTitle("Login");
|
||||||
|
});
|
||||||
|
|
||||||
|
function formSubmit(e: MouseEvent) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
useSessionStore().register(login)
|
useSessionStore().register(login.value)
|
||||||
.then(() => error.value = "")
|
.then(x => {
|
||||||
.catch(() => error.value = "Something went wrong!");
|
error.value = "";
|
||||||
|
useRouter().replace("/dashboard");
|
||||||
|
})
|
||||||
|
.catch(x => error.value = "The entered credentials are invalid!");
|
||||||
|
|
||||||
// TODO display invalidCredentials
|
// TODO display invalidCredentials
|
||||||
// TODO redirect to dashboard on success
|
// TODO redirect to dashboard on success
|
||||||
@ -18,44 +25,21 @@ function formSubmit(e: FormDataEvent) {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<v-container>
|
<div>
|
||||||
<v-row>
|
<input type="text" v-model="login.name"
|
||||||
<v-col cols="12">
|
placeholder="Name"
|
||||||
<v-text-field v-model="login.email" type="text" label="E-Mail" />
|
class="border-2 border-black rounded-lg block px-2 my-2 w-48" />
|
||||||
</v-col>
|
<input type="text" v-model="login.email"
|
||||||
<v-col cols="12">
|
placeholder="Email"
|
||||||
<v-text-field v-model="login.name" type="text" label="Name" />
|
class="border-2 border-black rounded-lg block px-2 my-2 w-48" />
|
||||||
</v-col>
|
<input type="password" v-model="login.password"
|
||||||
<v-col cols="6">
|
placeholder="Password"
|
||||||
<v-text-field
|
class="border-2 border-black rounded-lg block px-2 my-2 w-48" />
|
||||||
v-model="login.password"
|
</div>
|
||||||
label="Password"
|
<div>{{ error }}</div>
|
||||||
:append-icon="showPassword ? 'mdi-eye' : 'mdi-eye-off'"
|
<button type="submit" @click="formSubmit" class="bg-blue-300 rounded-lg p-2 w-48">Register</button>
|
||||||
:type="showPassword ? 'text' : 'password'"
|
|
||||||
@click:append="showPassword = showPassword"
|
|
||||||
:error-message="error"
|
|
||||||
error-count="2"
|
|
||||||
error
|
|
||||||
/>
|
|
||||||
</v-col>
|
|
||||||
<v-col cols="6">
|
|
||||||
<v-text-field
|
|
||||||
v-model="login.password"
|
|
||||||
label="Repeat password"
|
|
||||||
:append-icon="showPassword ? 'mdi-eye' : 'mdi-eye-off'"
|
|
||||||
:type="showPassword ? 'text' : 'password'"
|
|
||||||
@click:append="showPassword = showPassword"
|
|
||||||
:error-message="error"
|
|
||||||
error-count="2"
|
|
||||||
error
|
|
||||||
/>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
<div class="form-group">{{ error }}</div>
|
|
||||||
<v-btn type="submit" @click="formSubmit">Register</v-btn>
|
|
||||||
<p>
|
<p>
|
||||||
Existing user?
|
Existing user?
|
||||||
<router-link to="/login">Login</router-link>instead!
|
<router-link to="/login">Login</router-link>instead!
|
||||||
</p>
|
</p>
|
||||||
</v-container>
|
|
||||||
</template>
|
</template>
|
Loading…
x
Reference in New Issue
Block a user