Explorar o código

refactor toastError

Yuki Takei %!s(int64=4) %!d(string=hai) anos
pai
achega
1298c060b0
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      packages/app/src/client/util/apiNotification.js

+ 5 - 1
packages/app/src/client/util/apiNotification.js

@@ -34,8 +34,12 @@ const toastrOption = {
 export const toastError = (err, header = 'Error', option = toastrOption.error) => {
   const errs = toArrayIfNot(err);
 
+  if (err.length === 0) {
+    toastr.error('', header);
+  }
+
   for (const err of errs) {
-    toastr.error(err.message, header, option);
+    toastr.error(err.message || err, header, option);
   }
 };