diff --git a/src/components/MyNav.vue b/src/components/MyNav.vue
index f09e4fa..6fdb4e5 100644
--- a/src/components/MyNav.vue
+++ b/src/components/MyNav.vue
@@ -4,7 +4,25 @@
{{ site_info.name }}
- Hi {{ user.first_name }}
+
+
+
+ Hi {{ user.first_name }}
+
+
+
+
+
+
+
x.isUserMgmt == true)
+ }
+ },
data(){
return {
items: [],
- drawer: null
+ drawer: null,
+ drawer2: false
}
},
created() {
@@ -87,7 +111,7 @@ export default{
value:"/sop/printed"}]
})
- items.push({title: "Logout", value:"/logout"})
+ items.push({title: "Logout", value:"/logout", isUserMgmt: true})
return items
}
}
diff --git a/src/views/LoginPage.vue b/src/views/LoginPage.vue
index ca0c000..a8e2122 100644
--- a/src/views/LoginPage.vue
+++ b/src/views/LoginPage.vue
@@ -1,14 +1,22 @@
-
-
-
- Login
+
+
+
+ {{ error }}
+
+ Login
@@ -24,12 +32,15 @@ export default {
user: {
email: "",
password: ""
- }
+ },
+ error: "",
+ logging_in: false
}
},
methods: {
submitLogin() {
let url = this.$api_url + "/users/login"
+ this.logging_in = true
console.log("Logging in...")
axios
.post(url, {
@@ -38,6 +49,7 @@ export default {
})
.then(resp => {
let data = resp.data
+ console.log(data)
if (data.logged_in) {
let token = data.token
localStorage.setItem('access_token', token.content)
@@ -47,10 +59,17 @@ export default {
console.log("Logged in")
window.location.href = '/'
}
+ } else {
+ this.error = "Login failed. Invalid username or password."
}
})
- .catch(error => { console.log(error) })
-
+ .catch(error => {
+ console.log(error)
+ this.error = "Login failed. Invalid username or password."
+ })
+ .finally(() => {
+ this.logging_in = false
+ })
}
}
}