瀏覽代碼

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

jalbr74 6 年之前
父節點
當前提交
9f2cdd4b1e
共有 1 個文件被更改,包括 14 次插入1 次删除
  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 [
     '$stateProvider',
     '$urlRouterProvider',
@@ -30,7 +32,18 @@ export default [
     ) => {
         $urlRouterProvider.otherwise(
             ($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', {