privacy.route.ts 3.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import { Injectable } from '@angular/core';
  2. import { HttpResponse } from '@angular/common/http';
  3. import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot, Routes } from '@angular/router';
  4. import { UserRouteAccessService } from 'app/core';
  5. import { Observable, of } from 'rxjs';
  6. import { filter, map } from 'rxjs/operators';
  7. import { Privacy } from 'app/shared/model/privacy.model';
  8. import { PrivacyService } from './privacy.service';
  9. import { PrivacyComponent } from './privacy.component';
  10. import { PrivacyDetailComponent } from './privacy-detail.component';
  11. import { PrivacyUpdateComponent } from './privacy-update.component';
  12. import { PrivacyDeletePopupComponent } from './privacy-delete-dialog.component';
  13. import { IPrivacy } from 'app/shared/model/privacy.model';
  14. @Injectable({ providedIn: 'root' })
  15. export class PrivacyResolve implements Resolve<IPrivacy> {
  16. constructor(private service: PrivacyService) {}
  17. resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<Privacy> {
  18. const id = route.params['id'] ? route.params['id'] : null;
  19. if (id) {
  20. return this.service.find(id).pipe(
  21. filter((response: HttpResponse<Privacy>) => response.ok),
  22. map((privacy: HttpResponse<Privacy>) => privacy.body)
  23. );
  24. }
  25. return of(new Privacy());
  26. }
  27. }
  28. export const privacyRoute: Routes = [
  29. {
  30. path: 'privacy',
  31. component: PrivacyComponent,
  32. data: {
  33. authorities: ['ROLE_USER'],
  34. pageTitle: 'zipConnectApp.privacy.home.title'
  35. },
  36. canActivate: [UserRouteAccessService]
  37. },
  38. {
  39. path: 'privacy/:id/view',
  40. component: PrivacyDetailComponent,
  41. resolve: {
  42. privacy: PrivacyResolve
  43. },
  44. data: {
  45. authorities: ['ROLE_USER'],
  46. pageTitle: 'zipConnectApp.privacy.home.title'
  47. },
  48. canActivate: [UserRouteAccessService]
  49. },
  50. {
  51. path: 'privacy/new',
  52. component: PrivacyUpdateComponent,
  53. resolve: {
  54. privacy: PrivacyResolve
  55. },
  56. data: {
  57. authorities: ['ROLE_USER'],
  58. pageTitle: 'zipConnectApp.privacy.home.title'
  59. },
  60. canActivate: [UserRouteAccessService]
  61. },
  62. {
  63. path: 'privacy/:id/edit',
  64. component: PrivacyUpdateComponent,
  65. resolve: {
  66. privacy: PrivacyResolve
  67. },
  68. data: {
  69. authorities: ['ROLE_USER'],
  70. pageTitle: 'zipConnectApp.privacy.home.title'
  71. },
  72. canActivate: [UserRouteAccessService]
  73. }
  74. ];
  75. export const privacyPopupRoute: Routes = [
  76. {
  77. path: 'privacy/:id/delete',
  78. component: PrivacyDeletePopupComponent,
  79. resolve: {
  80. privacy: PrivacyResolve
  81. },
  82. data: {
  83. authorities: ['ROLE_USER'],
  84. pageTitle: 'zipConnectApp.privacy.home.title'
  85. },
  86. canActivate: [UserRouteAccessService],
  87. outlet: 'popup'
  88. }
  89. ];