Add prettier + eslint & reformat/fix files

This commit is contained in:
2020-04-23 17:32:45 +02:00
parent 932a9f8379
commit ebe8e640af
20 changed files with 1371 additions and 419 deletions
+24 -36
View File
@@ -1,11 +1,7 @@
<template>
<v-card flat>
<v-card-text>
<v-form
ref="form"
v-model="valid"
lazy-validation
>
<v-form ref="form" v-model="valid" lazy-validation>
<v-text-field
v-model="form.username"
:rules="usernameRules"
@@ -22,16 +18,11 @@
prepend-icon="mdi-lock"
type="password"
></v-text-field>
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer/>
<v-btn
:disabled="!valid"
color="success"
@click="userLogin"
>
<v-spacer />
<v-btn :disabled="!valid" color="success" @click="userLogin">
Login
</v-btn>
</v-card-actions>
@@ -39,30 +30,27 @@
</template>
<script>
export default {
name: "LoginForm",
methods: {
async userLogin() {
try {
const response = await this.$auth.loginWith('local', {data: this.form})
} catch (err) {
console.log(err)
}
export default {
name: 'LoginForm',
data: () => ({
valid: false,
form: {
username: '',
password: '',
},
usernameRules: [(v) => !!v || 'Name is required'],
passwordRules: [(v) => !!v || 'Password is required'],
}),
methods: {
userLogin() {
try {
this.$auth.loginWith('local', {
data: this.form,
})
} catch (err) {
console.log(err)
}
},
data: () => ({
valid: false,
form: {
username: '',
password: ''
},
usernameRules: [
v => !!v || 'Name is required',
],
passwordRules: [
v => !!v || 'Password is required',
]
}),
}
},
}
</script>
+39 -32
View File
@@ -1,7 +1,7 @@
<template>
<v-card
class="d-flex flex-column"
:class="{ hover:hover }"
:class="{ hover: hover }"
height="100%"
:color="hover ? 'blue lighten-3' : 'white'"
:elevation="hover ? 12 : 2"
@@ -10,50 +10,57 @@
<v-card-title>{{ title }}</v-card-title>
<div class="tags">
<v-chip v-for="tag in tags" :key="tag" active color="secondary">{{ tag }}</v-chip>
<v-chip
v-for="tag in tags"
:key="tag"
active
color="secondary"
>{{ tag }}</v-chip
>
</div>
</div>
<div class="mt-auto" v-if="updatedAt">
<v-divider/>
<div v-if="updatedAt" class="mt-auto">
<v-divider />
<v-card-subtitle>Last updated {{ updatedAt }}</v-card-subtitle>
</div>
</v-card>
</template>
<script>
export default {
name: 'Note',
props: {
title: {
type: String,
required: true,
},
tags: {
type: Array,
},
hover: {
type: Boolean,
default: 'false',
},
updatedAt: {
type: String,
default: null,
},
export default {
name: 'Note',
props: {
title: {
type: String,
required: true,
},
}
tags: {
type: Array,
default: () => [],
},
hover: {
type: Boolean,
default: false,
},
updatedAt: {
type: String,
default: null,
},
},
}
</script>
<style>
.tags {
padding: 16px;
}
.tags {
padding: 16px;
}
.tags .v-chip {
margin: 4px 8px 4px 0;
}
.tags .v-chip {
margin: 4px 8px 4px 0;
}
.v-card.hover {
cursor: pointer;
}
.v-card.hover {
cursor: pointer;
}
</style>
+34 -45
View File
@@ -1,11 +1,7 @@
<template>
<v-card flat>
<v-card-text>
<v-form
ref="form"
v-model="valid"
lazy-validation
>
<v-form ref="form" v-model="valid" lazy-validation>
<v-text-field
v-model="form.username"
:rules="usernameRules"
@@ -39,17 +35,12 @@
prepend-icon="mdi-lock"
type="password"
></v-text-field>
</v-form>
</v-card-text>
<v-divider/>
<v-divider />
<v-card-actions>
<v-spacer/>
<v-btn
:disabled="!valid"
color="success"
@click="registerUser"
>
<v-spacer />
<v-btn :disabled="!valid" color="success" @click="registerUser">
Register
</v-btn>
</v-card-actions>
@@ -57,37 +48,35 @@
</template>
<script>
export default {
name: "RegisterForm",
methods: {
async registerUser() {
const data = await this.$axios.post('/user', this.form)
console.log(data)
}
export default {
name: 'RegisterForm',
data: () => ({
valid: false,
form: {
username: '',
email: '',
password: '',
},
data: () => ({
valid: false,
form: {
username: '',
email: '',
password: ''
},
usernameRules: [
v => !!v || 'Name is required',
],
emailRules: [
v => !!v || 'Email is required',
v => /.+@.+/.test(v) || 'E-mail must be valid',
],
passwordRules: [
v => !!v || 'Password is required',
v => v.length >= 6 || 'Password must be longer than 6 characters',
],
confirm: '',
confirmRules: [
v => !!v || 'Password is required'
//v => confirmEquals() || 'Both passwords must be equals',
]
}),
}
usernameRules: [(v) => !!v || 'Name is required'],
emailRules: [
(v) => !!v || 'Email is required',
(v) => /.+@.+/.test(v) || 'E-mail must be valid',
],
passwordRules: [
(v) => !!v || 'Password is required',
(v) => v.length >= 6 || 'Password must be longer than 6 characters',
],
confirm: '',
confirmRules: [
(v) => !!v || 'Password is required',
// v => confirmEquals() || 'Both passwords must be equals',
],
}),
methods: {
async registerUser() {
const data = await this.$axios.post('/user', this.form)
console.log(data)
},
},
}
</script>