about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRakib Hasan <rmhasan@gmail.com>2017-02-19 10:54:27 +0000
committerRakib Hasan <rmhasan@gmail.com>2017-02-19 10:55:22 +0000
commitdfd4a42b350a0f258b0b1f8dcd2296289a98381c (patch)
tree15aef0f1cc2d1c17dfd7dcd472b727557f9d8546
parent910df0f7954d5991a64ff419fa60d8327807808f (diff)
added if else clause in fetchContext
So that if we get an error, then we will
only delete status if it is an 404 error
-rw-r--r--app/assets/javascripts/components/actions/statuses.jsx8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/assets/javascripts/components/actions/statuses.jsx b/app/assets/javascripts/components/actions/statuses.jsx
index 66b25f6f0..6f43539e0 100644
--- a/app/assets/javascripts/components/actions/statuses.jsx
+++ b/app/assets/javascripts/components/actions/statuses.jsx
@@ -103,8 +103,12 @@ export function fetchContext(id) {
       dispatch(fetchContextSuccess(id, response.data.ancestors, response.data.descendants));
       dispatch(fetchStatusCard(id));
     }).catch(error => {
-      dispatch(deleteStatusSuccess(id));
-      dispatch(deleteFromTimelines(id));
+      if (error.response.status == 404){
+        dispatch(deleteStatusSuccess(id));
+        dispatch(deleteFromTimelines(id));
+      }else{
+        dispatch(fetchContextFail(id, error));
+      }
     });
   };
 };