Skip to content

Commit

Permalink
fix create url issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Pandey, Kamlesh committed Jul 24, 2018
1 parent 0a4ed73 commit 15382ea
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ uiModules
$scope.indextarget = 'Index pattern ' + $scope.target
$scope.link = 'click here'
if($scope.count > 0){
patternId = response.data.hits.hits[0]._id
$http.post('../api/getShortUrl', request).then((response) => {
patternId = response.data.hits.hits[0]._id.substring(14)
var urlReq = {'timeFieldName': '@timestamp', 'title': patternId}
$http.post('../api/getShortUrl', urlReq).then((response) => {
$scope.urlfound = response.data.found;
if($scope.urlfound){
window.location.href=baseurl + "/goto/shorturl" + $scope.target
window.location.href=baseurl + "/goto/shorturl" + patternId
}
if(typeof $scope.urlfound === 'undefined'){
var createUrlReq = {'timeFieldName': '@timestamp', 'title': patternId.substring(14)}
$http.post('../api/createShortUrl', createUrlReq).then((response) => {
window.location.href=baseurl + "/goto/shorturl" + $scope.target
$http.post('../api/createShortUrl', urlReq).then((response) => {
window.location.href=baseurl + "/goto/shorturl" + patternId
});
}
});
Expand Down

0 comments on commit 15382ea

Please sign in to comment.