diff --git a/webui/src/views/HomeView.vue b/webui/src/views/HomeView.vue index b0291a2..1b84f12 100644 --- a/webui/src/views/HomeView.vue +++ b/webui/src/views/HomeView.vue @@ -26,6 +26,7 @@ export default { let response = await this.$axios.get("/stream?start_index=" + this.start_idx + "&limit=" + this.limit); + // Errors are handled by the interceptor, which shows a modal dialog to the user and returns a null response. if (response == null) { this.loading = false this.loadingError = true diff --git a/webui/src/views/LoginView.vue b/webui/src/views/LoginView.vue index 9bd49f6..103b07e 100644 --- a/webui/src/views/LoginView.vue +++ b/webui/src/views/LoginView.vue @@ -13,37 +13,40 @@ export default { async login() { this.loading = true; this.errormsg = null; - try { - let response = await this.$axios.post("/session", { - name: this.field_username, - }); - //this.$router.push({ name: "home" }); - if (response.status == 201 || response.status == 200) { - // Save the token in the local storage if the user wants to be remembered - if (this.rememberLogin) { - localStorage.setItem("token", response.data["user_id"]) - sessionStorage.removeItem("token"); - } - // Else save the token in the session storage - else { - sessionStorage.setItem("token", response.data["user_id"]); - localStorage.removeItem("token"); - } - // Tell the root view to enable the navbar - this.$root.setLoggedIn(); - // Update the header - this.$axiosUpdate(); - // Go back to the previous page - this.$router.go(-1); + let response = await this.$axios.post("/session", { + name: this.field_username, + }); + + // Errors are handled by the interceptor, which shows a modal dialog to the user and returns a null response. + if (response == null) { + this.loading = false + return + } + + if (response.status == 201 || response.status == 200) { + // Save the token in the local storage if the user wants to be remembered + if (this.rememberLogin) { + localStorage.setItem("token", response.data["user_id"]) + sessionStorage.removeItem("token"); } + // Else save the token in the session storage else { - this.errormsg = response.data["error"]; + sessionStorage.setItem("token", response.data["user_id"]); + localStorage.removeItem("token"); } + // Tell the root view to enable the navbar + this.$root.setLoggedIn(); + // Update the header + this.$axiosUpdate(); + + // Go back to the previous page + this.$router.go(-1); } - catch (e) { - this.errormsg = e.toString(); + else { + this.errormsg = response.data["error"]; } + this.loading = false; }, }, @@ -51,50 +54,57 @@ export default { diff --git a/webui/src/views/SearchView.vue b/webui/src/views/SearchView.vue index 77b1253..c4af43d 100644 --- a/webui/src/views/SearchView.vue +++ b/webui/src/views/SearchView.vue @@ -1,7 +1,7 @@