@@ -21,7 +21,7 @@ export function ExceptionController($scope, $http, $location, menuService, pagin
21
21
const getQueryString = function ( ) {
22
22
removeUnwelcomeParameters ( ) ;
23
23
let query = decodeURI ( window . location . search ) ;
24
- if ( query . includes ( "?" ) ) {
24
+ if ( query . length > 0 && query [ 0 ] === "?" ) {
25
25
query = query . slice ( 1 ) ;
26
26
}
27
27
if ( query . includes ( "genericSearch=" ) ) {
@@ -41,9 +41,13 @@ export function ExceptionController($scope, $http, $location, menuService, pagin
41
41
} ) ;
42
42
43
43
paginationService . init ( 'exceptions' ) ;
44
- $http . get ( 'api/num_exceptions' + window . location . search ) . then ( function ( response ) {
45
- paginationService . setTotal ( response . data ) ;
46
- } ) ;
44
+
45
+ const setPaginationTotal = function ( ) {
46
+ $http . get ( 'api/num_exceptions' + window . location . search ) . then ( function ( response ) {
47
+ paginationService . setTotal ( response . data ) ;
48
+ } ) ;
49
+ }
50
+ setPaginationTotal ( ) ;
47
51
48
52
$scope . getEndpoint = function ( ) {
49
53
return 'api/exception_info/' + paginationService . getLeft ( ) + '/' + paginationService . perPage ;
@@ -79,15 +83,12 @@ export function ExceptionController($scope, $http, $location, menuService, pagin
79
83
$scope . query = function ( ) {
80
84
if ( $scope . queryString === $scope . oldQuery ) return ;
81
85
$scope . buildQueryString ( $scope . queryString ) ;
82
- paginationService . onReload ( ) ;
86
+ setPaginationTotal ( ) ;
83
87
}
84
88
85
89
paginationService . onReload = function ( ) {
86
90
$http . get ( $scope . getEndpoint ( ) + window . location . search ) . then ( function ( response ) {
87
91
$scope . table = response . data ;
88
92
} ) ;
89
- $http . get ( 'api/num_exceptions' + window . location . search ) . then ( function ( response ) {
90
- paginationService . total = response . data ;
91
- } ) ;
92
93
} ;
93
94
} ;
0 commit comments