Browse Source

Fixed the help desk not remembering which view it was on when you come back later.

jalbr74 6 years ago
parent
commit
9f2cdd4b1e
1 changed files with 14 additions and 1 deletions
  1. 14 1
      client/src/modules/helpdesk/routes.ts

+ 14 - 1
client/src/modules/helpdesk/routes.ts

@@ -21,6 +21,8 @@
  */
  */
 
 
 
 
+import LocalStorageService from '../../services/local-storage.service';
+
 export default [
 export default [
     '$stateProvider',
     '$stateProvider',
     '$urlRouterProvider',
     '$urlRouterProvider',
@@ -30,7 +32,18 @@ export default [
     ) => {
     ) => {
         $urlRouterProvider.otherwise(
         $urlRouterProvider.otherwise(
             ($injector: angular.auto.IInjectorService, $location: angular.ILocationService) => {
             ($injector: angular.auto.IInjectorService, $location: angular.ILocationService) => {
-                $location.url('search/cards');
+                let $state: angular.ui.IStateService = <angular.ui.IStateService>$injector.get('$state');
+                let localStorageService: LocalStorageService =
+                    <LocalStorageService>$injector.get('LocalStorageService');
+
+                let storedView = localStorageService.getItem(localStorageService.keys.HELPDESK_SEARCH_VIEW);
+
+                if (storedView) {
+                    $state.go(storedView);
+                }
+                else {
+                    $location.url('search/cards');
+                }
             });
             });
 
 
         $stateProvider.state('search', {
         $stateProvider.state('search', {