Skip to content
This repository was archived by the owner on Dec 8, 2022. It is now read-only.

Commit 7358194

Browse files
committed
linter fixes
1 parent b2724cd commit 7358194

File tree

4 files changed

+401
-370
lines changed

4 files changed

+401
-370
lines changed

src/views/Login.vue

Lines changed: 83 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,94 @@
11
<template>
2-
<v-row align="center" justify="center">
3-
<v-col cols="12" sm="8" md="4">
4-
<v-card flat class="mt-12">
5-
<v-toolbar color="secondary" dark flat>
6-
<v-toolbar-title>Login form</v-toolbar-title>
7-
</v-toolbar>
8-
<v-form @submit.prevent="validate" ref="form">
9-
<v-card-text>
10-
<v-text-field
11-
v-bind="fields.username"
12-
v-model="fields.username.value"
13-
:disabled="isSubmitting"
14-
/>
2+
<v-row align="center" justify="center">
3+
<v-col cols="12" sm="8" md="4">
4+
<v-card flat class="mt-12">
5+
<v-toolbar color="secondary" dark flat>
6+
<v-toolbar-title>Login form</v-toolbar-title>
7+
</v-toolbar>
8+
<v-form @submit.prevent="validate" ref="form">
9+
<v-card-text>
10+
<v-text-field
11+
v-bind="fields.username"
12+
v-model="fields.username.value"
13+
:disabled="isSubmitting"
14+
/>
1515

16-
<v-text-field
17-
v-bind="fields.password"
18-
v-model="fields.password.value"
19-
:disabled="isSubmitting"
20-
/>
21-
</v-card-text>
16+
<v-text-field
17+
v-bind="fields.password"
18+
v-model="fields.password.value"
19+
:disabled="isSubmitting"
20+
/>
21+
</v-card-text>
2222

23-
<v-card-text>
24-
<router-link :to="{ name: 'reset-password' }">Forgot your password?</router-link>
25-
</v-card-text>
23+
<v-card-text>
24+
<router-link :to="{ name: 'reset-password' }"
25+
>Forgot your password?</router-link
26+
>
27+
</v-card-text>
2628

27-
<v-card-actions>
28-
<v-spacer />
29-
<v-btn color="secondary darken-2" type="submit" dark :disabled="isSubmitting">Sign In</v-btn>
30-
</v-card-actions>
31-
</v-form>
32-
</v-card>
33-
</v-col>
34-
</v-row>
29+
<v-card-actions>
30+
<v-spacer />
31+
<v-btn
32+
color="secondary darken-2"
33+
type="submit"
34+
dark
35+
:disabled="isSubmitting"
36+
>Sign In</v-btn
37+
>
38+
</v-card-actions>
39+
</v-form>
40+
</v-card>
41+
</v-col>
42+
</v-row>
3543
</template>
3644

3745
<script>
3846
import { auth } from "@/api";
3947
export default {
40-
name: "login",
41-
methods: {
42-
async submit() {
43-
if (this.isSubmitting) {
44-
return;
45-
}
46-
this.isSubmitting = true;
47-
try {
48-
await auth.login(
49-
this.fields.username.value,
50-
this.fields.password.value
51-
);
52-
localStorage.setItem("lastUsername", this.fields.username.value);
53-
this.$store.dispatch("Snackbar/showInfo", "Successfully Logged In");
54-
this.$router.push({ name: "quiz" });
55-
} catch (err) {
56-
this.$store.dispatch("Snackbar/showError", err);
57-
}
58-
this.isSubmitting = false;
59-
},
60-
validate() {
61-
if (this.$refs.form.validate()) {
62-
this.submit();
63-
}
64-
}
65-
},
66-
data() {
67-
return {
68-
isSubmitting: false,
69-
fields: {
70-
username: {
71-
label: "Username",
72-
type: "text",
73-
value: localStorage.getItem("lastEmail"),
74-
rules: [v => !!v || "Please provide a username"]
75-
},
76-
password: {
77-
label: "Password",
78-
type: "password",
79-
value: "",
80-
rules: [v => !!v || "Please provide a password"]
81-
}
82-
}
83-
};
84-
}
48+
name: "login",
49+
methods: {
50+
async submit() {
51+
if (this.isSubmitting) {
52+
return;
53+
}
54+
this.isSubmitting = true;
55+
try {
56+
await auth.login(
57+
this.fields.username.value,
58+
this.fields.password.value
59+
);
60+
localStorage.setItem("lastUsername", this.fields.username.value);
61+
this.$store.dispatch("Snackbar/showInfo", "Successfully Logged In");
62+
this.$router.push({ name: "quiz" });
63+
} catch (err) {
64+
this.$store.dispatch("Snackbar/showError", err);
65+
}
66+
this.isSubmitting = false;
67+
},
68+
validate() {
69+
if (this.$refs.form.validate()) {
70+
this.submit();
71+
}
72+
}
73+
},
74+
data() {
75+
return {
76+
isSubmitting: false,
77+
fields: {
78+
username: {
79+
label: "Username",
80+
type: "text",
81+
value: localStorage.getItem("lastEmail"),
82+
rules: [v => !!v || "Please provide a username"]
83+
},
84+
password: {
85+
label: "Password",
86+
type: "password",
87+
value: "",
88+
rules: [v => !!v || "Please provide a password"]
89+
}
90+
}
91+
};
92+
}
8593
};
8694
</script>

src/views/Register/Step1.vue

Lines changed: 61 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,69 @@
11
<template>
2-
<v-form @submit.prevent="validate" ref="form" v-model="isValid">
3-
<v-card-text>
4-
<v-text-field
5-
v-bind="fields.username"
6-
v-model="fields.username.value"
7-
:disabled="isSubmitting"
8-
/>
9-
<v-text-field
10-
v-bind="fields.parentEmail"
11-
v-model="fields.parentEmail.value"
12-
:disabled="isSubmitting"
13-
/>
14-
<v-text-field v-bind="fields.password" v-model="fields.password.value" :disabled="isSubmitting" />
15-
<v-text-field
16-
v-bind="fields.passwordConfirm"
17-
v-model="fields.passwordConfirm.value"
18-
:disabled="isSubmitting"
19-
/>
20-
</v-card-text>
2+
<v-form @submit.prevent="validate" ref="form" v-model="isValid">
3+
<v-card-text>
4+
<v-text-field
5+
v-bind="fields.username"
6+
v-model="fields.username.value"
7+
:disabled="isSubmitting"
8+
/>
9+
<v-text-field
10+
v-bind="fields.parentEmail"
11+
v-model="fields.parentEmail.value"
12+
:disabled="isSubmitting"
13+
/>
14+
<v-text-field
15+
v-bind="fields.password"
16+
v-model="fields.password.value"
17+
:disabled="isSubmitting"
18+
/>
19+
<v-text-field
20+
v-bind="fields.passwordConfirm"
21+
v-model="fields.passwordConfirm.value"
22+
:disabled="isSubmitting"
23+
/>
24+
</v-card-text>
2125

22-
<v-card-actions>
23-
<v-spacer />
24-
<v-btn color="secondary darken-2" type="submit" :disabled="isSubmitting">
25-
Next
26-
<v-progress-circular size="14" class="ml-3" indeterminate v-if="isSubmitting" />
27-
</v-btn>
28-
</v-card-actions>
29-
</v-form>
26+
<v-card-actions>
27+
<v-spacer />
28+
<v-btn color="secondary darken-2" type="submit" :disabled="isSubmitting">
29+
Next
30+
<v-progress-circular
31+
size="14"
32+
class="ml-3"
33+
indeterminate
34+
v-if="isSubmitting"
35+
/>
36+
</v-btn>
37+
</v-card-actions>
38+
</v-form>
3039
</template>
3140

3241
<script>
3342
export default {
34-
name: "register-step-1",
35-
props: ["fields"],
36-
methods: {
37-
async submit() {
38-
if (this.isSubmitting) {
39-
return;
40-
}
41-
this.isSubmitting = true;
42-
const cb = () => {
43-
this.isSubmitting = false;
44-
};
45-
this.$emit("submit", cb);
46-
},
47-
validate() {
48-
if (this.$refs.form.validate()) {
49-
this.submit();
50-
}
51-
}
52-
},
53-
data() {
54-
return {
55-
isValid: false,
56-
isSubmitting: false
57-
};
58-
}
43+
name: "register-step-1",
44+
props: ["fields"],
45+
methods: {
46+
async submit() {
47+
if (this.isSubmitting) {
48+
return;
49+
}
50+
this.isSubmitting = true;
51+
const cb = () => {
52+
this.isSubmitting = false;
53+
};
54+
this.$emit("submit", cb);
55+
},
56+
validate() {
57+
if (this.$refs.form.validate()) {
58+
this.submit();
59+
}
60+
}
61+
},
62+
data() {
63+
return {
64+
isValid: false,
65+
isSubmitting: false
66+
};
67+
}
5968
};
6069
</script>

0 commit comments

Comments
 (0)