From 06a3bde0d16c8379a661ce4209c7007fb3329cfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Panzar?= Date: Sat, 3 Oct 2020 10:16:51 +0200 Subject: [PATCH] Migrate to latest Play version - addresses #92 Fixes UI tests. --- .../project/settings/project-settings-update.spec.ts | 2 +- .../translatr/src/app/interceptors/auth.interceptor.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ui/apps/translatr-e2e/src/integration/project/settings/project-settings-update.spec.ts b/ui/apps/translatr-e2e/src/integration/project/settings/project-settings-update.spec.ts index f0d05f9b..6b8cd60b 100644 --- a/ui/apps/translatr-e2e/src/integration/project/settings/project-settings-update.spec.ts +++ b/ui/apps/translatr-e2e/src/integration/project/settings/project-settings-update.spec.ts @@ -16,8 +16,8 @@ describe('Project Settings Update', () => { cy.route('/api/project/*/keys*', 'fixture:johndoe/p1/keys'); cy.route('/api/project/*/messages*', 'fixture:johndoe/p1/messages'); cy.route('/api/project/*/members*', 'fixture:johndoe/p1/members'); - cy.route('/api/project/*/activities*', 'fixture:johndoe/p1/activities'); cy.route('/api/activities/aggregated*', 'fixture:johndoe/p1/activities-aggregated'); + cy.route('/api/activities*', 'fixture:johndoe/p1/activities'); }); it('should persist on save', () => { diff --git a/ui/apps/translatr/src/app/interceptors/auth.interceptor.ts b/ui/apps/translatr/src/app/interceptors/auth.interceptor.ts index 50633af1..8b692b6e 100644 --- a/ui/apps/translatr/src/app/interceptors/auth.interceptor.ts +++ b/ui/apps/translatr/src/app/interceptors/auth.interceptor.ts @@ -8,8 +8,8 @@ import { import { Inject, Injectable } from '@angular/core'; import { NavigationCancel, Router } from '@angular/router'; import { LOGIN_URL } from '@translatr/utils'; -import { Observable, of } from 'rxjs'; -import { catchError, filter, shareReplay } from 'rxjs/operators'; +import { Observable, throwError } from 'rxjs'; +import { catchError, filter, shareReplay, take } from 'rxjs/operators'; const HTTP_STATUS_BAD_REQUEST = 400; const HTTP_STATUS_UNAUTHORIZED = 401; @@ -74,7 +74,7 @@ export class AuthInterceptor implements HttpInterceptor { case HTTP_STATUS_UNAUTHORIZED: // Unauthorized, redirecting to login page - this.navigationCancelled$.subscribe(event => + this.navigationCancelled$.pipe(take(1)).subscribe(event => this.router.navigate([this.loginUrl], { queryParamsHandling: 'merge', queryParams: { redirect_uri: `/ui${event.url}` } @@ -107,7 +107,7 @@ export class AuthInterceptor implements HttpInterceptor { break; } - return of(err as any); + return throwError(err as any); }) ); }