Kaynağa Gözat

Fix occasional UI 'Error setting up request' alert

When cancelling an API request, the app's production build would
interpret the cancellation as an error, due to the fact that the
production build minimizes the class' names.

Solved by using a different method to find out if the error was an
actual error or just a canceled request.
Sergiu Miclea 5 yıl önce
ebeveyn
işleme
8e62a500e2
1 değiştirilmiş dosya ile 1 ekleme ve 1 silme
  1. 1 1
      src/utils/ApiCaller.ts

+ 1 - 1
src/utils/ApiCaller.ts

@@ -200,7 +200,7 @@ class ApiCaller {
           })
           })
           reject({})
           reject({})
         } else {
         } else {
-          const canceled = error.constructor.name === 'Cancel'
+          const canceled = error.__CANCEL__
           reject({ canceled })
           reject({ canceled })
           if (canceled) {
           if (canceled) {
             logger.log({
             logger.log({