Skip to content

Commit c5eeaad

Browse files
committed
yet another quality commit
1 parent 5afbdca commit c5eeaad

File tree

4 files changed

+27
-27
lines changed

4 files changed

+27
-27
lines changed

src/components/BarChart.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as d3 from "d3";
33
export default {
44
name: "BarChart",
55
props: ["chartData", "attrClass"],
6-
template: "<div></div",
6+
template: "<div></div>",
77
methods: {
88
drawBarChart() {
99
let dataset = [];

src/components/PieChart.vue

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as d3 from "d3";
33
export default {
44
name: "PieChart",
55
props: ["chartData", "attrClass"],
6-
template: "<div></div",
6+
template: "<div></div>",
77
methods: {
88
drawPieChart() {
99
let dataset = [];
@@ -26,15 +26,7 @@ export default {
2626
2727
let color = d3
2828
.scaleOrdinal()
29-
.range([
30-
"#98abc5",
31-
"#8a89a6",
32-
"#7b6888",
33-
"#6b486b",
34-
"#a05d56",
35-
"#d0743c",
36-
"#ff8c00"
37-
]);
29+
.range(["#b3b300", "#8a89a6", "#d0743c", "#ff8c00"]);
3830
3931
let arc = d3
4032
.arc()

src/views/Login.vue

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="login-container">
3-
<form class="form-signin">
3+
<form class="form-signin" @submit="onSubmit">
44
<label for="inputEmail" class="sr-only">Username</label>
55
<input
66
type="text"
@@ -20,13 +20,12 @@
2020
placeholder="Password"
2121
required
2222
/>
23-
<button
24-
class="btn btn-lg btn-primary btn-block"
25-
v-on:click="login()"
26-
type="submit"
27-
>
23+
<button class="btn btn-lg btn-primary btn-block" type="submit">
2824
Sign in
2925
</button>
26+
<div class="error-message" v-show="showErrorMessage">
27+
<span>Incorrect username or password. Please try again.</span>
28+
</div>
3029
</form>
3130
</div>
3231
</template>
@@ -39,19 +38,15 @@ export default {
3938
input: {
4039
username: "",
4140
password: ""
42-
}
41+
},
42+
showErrorMessage: false
4343
};
4444
},
4545
methods: {
46-
login() {
47-
if (
48-
this.input.username.trim() === "" ||
49-
this.input.password.trim() === ""
50-
) {
51-
// show an error message to the user
52-
return;
53-
}
46+
onSubmit(event) {
47+
event.preventDefault();
5448
49+
let authenticated = false;
5550
let mockAccounts = this.$parent.mockAccounts;
5651
for (let i = 0; i < mockAccounts.length; i++) {
5752
let account = mockAccounts[i];
@@ -62,9 +57,14 @@ export default {
6257
) {
6358
continue;
6459
}
65-
this.$emit("authenticated", true);
60+
authenticated = true;
61+
this.$emit("authenticated", authenticated);
6662
this.$router.replace({ name: "home" });
6763
}
64+
65+
if (!this.authenticated) {
66+
this.showErrorMessage = true;
67+
}
6868
}
6969
}
7070
};
@@ -78,6 +78,11 @@ export default {
7878
align-items: center;
7979
padding-top: 40px;
8080
padding-bottom: 40px;
81+
82+
.error-message {
83+
margin-top: 15px;
84+
font-size: 85%;
85+
}
8186
}
8287
8388
.form-signin {

vue.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
runtimeCompiler: true
3+
};

0 commit comments

Comments
 (0)