From dfd4a42b350a0f258b0b1f8dcd2296289a98381c Mon Sep 17 00:00:00 2001 From: Rakib Hasan Date: Sun, 19 Feb 2017 10:54:27 +0000 Subject: [PATCH] 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 --- app/assets/javascripts/components/actions/statuses.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/components/actions/statuses.jsx b/app/assets/javascripts/components/actions/statuses.jsx index 66b25f6f01..6f43539e07 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)); + } }); }; };