From b0f8cf22df75851314d6b5a7a85149d9240ac56b Mon Sep 17 00:00:00 2001 From: Juanfran Date: Thu, 23 Nov 2023 08:53:38 +0100 Subject: [PATCH] fix: redirect to the 404 page when project id is invalid --- .../project-feature-shell-resolver.service.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/javascript/apps/taiga/src/app/modules/project/feature-shell/project-feature-shell-resolver.service.ts b/javascript/apps/taiga/src/app/modules/project/feature-shell/project-feature-shell-resolver.service.ts index 871dc2d00..551f9e4ac 100644 --- a/javascript/apps/taiga/src/app/modules/project/feature-shell/project-feature-shell-resolver.service.ts +++ b/javascript/apps/taiga/src/app/modules/project/feature-shell/project-feature-shell-resolver.service.ts @@ -8,7 +8,7 @@ import { HttpErrorResponse } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { ActivatedRouteSnapshot } from '@angular/router'; +import { ActivatedRouteSnapshot, Router } from '@angular/router'; import { ProjectApiService } from '@taiga/api'; import { of } from 'rxjs'; import { catchError } from 'rxjs/operators'; @@ -20,7 +20,8 @@ import { RevokeInvitationService } from '~/app/services/revoke-invitation.servic export class ProjectFeatureShellResolverService { constructor( private projectApiService: ProjectApiService, - private revokeInvitationService: RevokeInvitationService + private revokeInvitationService: RevokeInvitationService, + private router: Router ) {} public resolve(route: ActivatedRouteSnapshot) { @@ -30,6 +31,10 @@ export class ProjectFeatureShellResolverService { catchError((httpResponse: HttpErrorResponse) => { this.revokeInvitationService.shellResolverRevokeError(httpResponse); + if (httpResponse.status === 422) { + void this.router.navigate(['/not-found']); + } + return of(null); }) );