route-error-handler.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Password Management Servlets (PWM)
  3. * http://www.pwm-project.org
  4. *
  5. * Copyright (c) 2006-2009 Novell, Inc.
  6. * Copyright (c) 2009-2021 The PWM Project
  7. *
  8. * Licensed under the Apache License, Version 2.0 (the "License");
  9. * you may not use this file except in compliance with the License.
  10. * You may obtain a copy of the License at
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. *
  14. * Unless required by applicable law or agreed to in writing, software
  15. * distributed under the License is distributed on an "AS IS" BASIS,
  16. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. * See the License for the specific language governing permissions and
  18. * limitations under the License.
  19. */
  20. import { IAngularEvent, IRootScopeService } from 'angular';
  21. import { IStateService } from 'angular-ui-router';
  22. export default [
  23. '$transitions',
  24. '$state',
  25. ($transitions, $state: IStateService) => {
  26. $transitions.onError({}, (transition) => {
  27. if (transition._error === 'OrgChart disabled') {
  28. $state.go('search.cards');
  29. }
  30. });
  31. }
  32. ];