Skip to content

Commit

Permalink
#2044 Use CaseSrv.getById method to fetch case by number instead a se…
Browse files Browse the repository at this point in the history
…arch by caseId
  • Loading branch information
nadouani committed May 31, 2021
1 parent d2f5153 commit 37998df
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions frontend/app/scripts/controllers/RootCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,20 +261,17 @@ angular.module('theHiveControllers').controller('RootCtrl',
return;
}

CaseSrv.query({
query: {
caseId: caseId
},
range: '0-1'
}, function (response) {
if (response.length === 1) {
$state.go('app.case.details', { caseId: response[0].id }, { reload: true });
} else {
NotificationSrv.log('Unable to find the case with number ' + caseId, 'error');
}
}, function (err) {
NotificationSrv.error('Case search', err.data, err.status);
});
CaseSrv.getById(caseId.toString())
.then(function (response) {
if (response !== undefined) {
$state.go('app.case.details', { caseId: response._id });
} else {
NotificationSrv.log('Unable to find the case with number ' + caseId, 'error');
}
})
.catch(function (err) {
NotificationSrv.error('Case search', err.data, err.status);
})
};

// Used to show spinning refresh icon n times
Expand Down

0 comments on commit 37998df

Please sign in to comment.