Improve front-end HTTP error handling (#397)

* UI for HTTP error handing in diffexp route

* HTTP error handling for other routes

* clean up toasters
This commit is contained in:
Bruce Martin
2018-10-30 19:02:11 -07:00
committed by GitHub
parent b181751493
commit 9d7754e31e
4 changed files with 104 additions and 97 deletions
+18 -6
View File
@@ -1,12 +1,24 @@
import { Position, Toaster, Intent } from "@blueprintjs/core";
/** Singleton toaster instance. Create separate instances for different options. */
export const ErrorToastTopCenter = Toaster.create({
const ErrorToastTopCenter = Toaster.create({
className: "recipe-toaster",
position: Position.TOP,
intent: Intent.WARNING
position: Position.TOP
});
export default {
ErrorToastTopCenter
};
/*
A "user" error - eg, bad input
*/
export const postUserErrorToast = message =>
ErrorToastTopCenter.show({ message, intent: Intent.WARNING });
/*
a hard network error
*/
export const postNetworkErrorToast = message =>
ErrorToastTopCenter.show({
message,
timeout: 30000,
intent: Intent.DANGER
});