parent.navigate(redirectPath || "/");
})
.catch(function(error) {
- if ([400, 422].includes(error.response.status)) {
+ if (error.handled) {
+ return;
+ } else if ([400, 422].includes(error.response.status)) {
parent.$bvToast.toast("Incorrect Username or Password ✘", {
variant: "danger",
noCloseButton: true,
});
+ } else {
+ parent.unhandledServerErrorToast();
}
})
.finally(function() {
)
);
});
+ })
+ .catch(function(error) {
+ if (!error.handled) {
+ parent.unhandledServerErrorToast();
+ }
});
},
response.data.content
);
parent.updateDocumentTitle();
+ })
+ .catch(function(error) {
+ if (!error.handled) {
+ parent.unhandledServerErrorToast();
+ }
});
},
})
.then(this.saveNoteResponseHandler)
.catch(function(error) {
- if (error.response.status == 409) {
+ if (error.handled) {
+ return;
+ } else if (error.response.status == 409) {
parent.existingFilenameToast();
+ } else {
+ parent.unhandledServerErrorToast();
}
});
}
})
.then(this.saveNoteResponseHandler)
.catch(function(error) {
- if (error.response.status == 409) {
+ if (error.handled) {
+ return;
+ } else if (error.response.status == 409) {
parent.existingFilenameToast();
+ } else {
+ parent.unhandledServerErrorToast();
}
});
}
variant: "success",
noCloseButton: true,
});
+ })
+ .catch(function(error) {
+ if (!error.handled) {
+ parent.unhandledServerErrorToast();
+ }
});
}
});
// this.saveNote();
// }
},
+
+ unhandledServerErrorToast: function() {
+ this.$bvToast.toast(
+ "Unknown error communicating with the server. Please try again.",
+ {
+ title: "Unknown Error",
+ variant: "danger",
+ noCloseButton: true,
+ }
+ );
+ },
},
created: function() {
EventBus.$on("navigate", this.navigate);
+ EventBus.$on("unhandledServerError", this.unhandledServerErrorToast);
document.addEventListener("keydown", this.keyboardShortcuts);
let token = localStorage.getItem("token");
"bootstrap": "4.6",
"bootstrap-vue": "^2.21.2",
"parcel-bundler": "^1.12.5",
+ "portal-vue": "^2.1.7",
"sass": "^1.37.5",
"vue": "^2.6.14",
"vue-hot-reload-api": "^2.3.4",