X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fcore%2Fauth%2Fauth.service.ts;h=6fe601d8d24634275bfb0e555e3560d5aad07f3d;hb=98bd5e2256bfdeba6d5ab07f0421acfde1a0de26;hp=ed7eabb76c5442dae30e1379b9b04d96b24603e7;hpb=0a8a79552cf59c800011c9f63eaa8658230acddc;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts index ed7eabb76..6fe601d8d 100644 --- a/client/src/app/core/auth/auth.service.ts +++ b/client/src/app/core/auth/auth.service.ts @@ -5,11 +5,11 @@ import { HttpClient, HttpErrorResponse, HttpHeaders, HttpParams } from '@angular import { Injectable } from '@angular/core' import { Router } from '@angular/router' import { Notifier } from '@app/core/notification/notifier.service' -import { logger, OAuthUserTokens, objectToUrlEncoded, peertubeLocalStorage, PluginsManager } from '@root-helpers/index' +import { logger, OAuthUserTokens, objectToUrlEncoded, peertubeLocalStorage } from '@root-helpers/index' import { HttpStatusCode, MyUser as UserServerModel, OAuthClientLocal, User, UserLogin, UserRefreshToken } from '@shared/models' import { environment } from '../../../environments/environment' import { RestExtractor } from '../rest/rest-extractor.service' -import { ServerService } from '../server' +import { RedirectService } from '../routing' import { AuthStatus } from './auth-status.model' import { AuthUser } from './auth-user.model' @@ -45,7 +45,7 @@ export class AuthService { private refreshingTokenObservable: Observable constructor ( - private serverService: ServerService, + private redirectService: RedirectService, private http: HttpClient, private notifier: Notifier, private hotkeysService: HotkeysService, @@ -227,9 +227,7 @@ Ensure you have correctly configured PeerTube (config/ directory), in particular logger.info('Cannot refresh token -> logout...') this.logout() - const externalLoginUrl = PluginsManager.getDefaultLoginHref(environment.apiUrl, this.serverService.getHTMLConfig()) - if (externalLoginUrl) window.location.href = externalLoginUrl - else this.router.navigate([ '/login' ]) + this.redirectService.redirectToLogin() return observableThrowError(() => ({ error: $localize`You need to reconnect.`