- errorFn: (id, error) => {
- // console.error("Backend error:", error);
- // store.dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Backend error", kind: SnackbarKind.ERROR }));
+ errorFn: (id, error, showSnackBar) => {
+ if (showSnackBar) {
+ console.error("Backend error:", error);
+
+ if (error.status === 404) {
+ store.dispatch(openNotFoundDialog());
+ } else if (error.status === 401 && error.errors[0].indexOf("Not logged in") > -1) {
+ store.dispatch(logout());
+ } else {
+ store.dispatch(snackbarActions.OPEN_SNACKBAR({
+ message: `${error.errors
+ ? error.errors[0]
+ : error.message}`,
+ kind: SnackbarKind.ERROR,
+ hideDuration: 8000})
+ );
+ }
+ }