INIT commit

This commit is contained in:
Michal Kváček
2023-05-31 20:44:10 +02:00
commit a3e8917db5
73 changed files with 5405 additions and 0 deletions
View File
+10
View File
@@ -0,0 +1,10 @@
<script setup>
</script>
<template>
<router-link :to='{"name": "login"}'>Login</router-link>
<router-link :to='{"name": "registration"}'>Register</router-link>
</template>
+48
View File
@@ -0,0 +1,48 @@
<script setup>
import {ref} from "vue";
import {useUserStore} from "stores/User";
import {useRouter} from "vue-router";
const email = ref("");
const password = ref("");
const router = useRouter();
const logUser = () => {
useUserStore().login({email: email.value, password: password.value}).then(() => {
console.log("tu ok");
router.push({name: "myFlights"});
});
};
</script>
<template>
<q-page class="window-height window-width row justify-center">
<q-card square style="width:95%; max-width: 450px; height:400px;" class="q-mt-lg">
<q-card-section class="bg-accent">
<h4 class="text-h5 q-my-md text-white">Login</h4>
</q-card-section>
<q-card-section>
<q-form class="q-px-sm q-pt-xl" @submit.prevent="logUser()">
<q-input square clearable v-model="email" type="email" label="Email">
<template v-slot:prepend>
<q-icon name="email"/>
</template>
</q-input>
<q-input square clearable v-model="password" type="password" label="Password">
<template v-slot:prepend>
<q-icon name="lock"/>
</template>
</q-input>
</q-form>
</q-card-section>
<q-card-actions class="q-px-lg">
<q-btn unelevated size="lg" class="full-width" label="Sign In" @click.prevent="logUser()"/>
</q-card-actions>
<q-card-section class="text-center q-pa-sm">
<p class="text-grey-6">Forgot your password?</p>
</q-card-section>
</q-card>
</q-page>
</template>
+79
View File
@@ -0,0 +1,79 @@
<script setup>
import {ref} from "vue";
import {useUserStore} from "stores/User";
import {useRouter} from "vue-router";
import {useQuasar} from "quasar";
const email = ref("");
const name = ref("");
const password = ref("");
const router = useRouter();
const $q = useQuasar();
const registerUser = () => {
useUserStore().register({
email: email.value,
name: name.value,
password: password.value
}).then(() => {
$q.notify({message: "Registration Ok, now login", position: "top", color: "positive"});
router.push({name: 'login'})
}).catch(({response}) => {
$q.notify({
message: "Registration failed",
position: "top",
color: "negative",
timeout: 0,
actions: [
{
label: "Dismiss", color: "white"
}
]
});
})
}
</script>
<template>
<q-page
class="window-height window-width row justify-center items-center"
>
<div class="column q-pa-lg">
<div class="row">
<q-card square class="shadow-24" style="width:300px;height:485px;">
<q-card-section class="bg-deep-purple-7">
<h4 class="text-h5 text-white q-my-md">Registration</h4>
</q-card-section>
<q-card-section>
<q-form class="q-px-sm q-pt-xl q-pb-lg" @submit.prevent="registerUser">
<q-input square clearable v-model="name" type="text" label="Name">
<template v-slot:prepend>
<q-icon name="person"/>
</template>
</q-input>
<q-input square clearable v-model="email" type="email" label="E-mail">
<template v-slot:prepend>
<q-icon name="email"/>
</template>
</q-input>
<q-input square clearable v-model="password" type="password" label="Password">
<template v-slot:prepend>
<q-icon name="lock"/>
</template>
</q-input>
</q-form>
</q-card-section>
<q-card-actions class="q-px-lg">
<q-btn @click="registerUser" unelevated size="lg" color="purple-4" class="full-width text-white" label="Get Started"/>
</q-card-actions>
<q-card-section class="text-center q-pa-sm">
<router-link :to="{name: 'login'}" class="text-grey-6">Return to login</router-link>
</q-card-section>
</q-card>
</div>
</div>
</q-page>
</template>