diff --git a/openvidu-call-front/src/app/core/guards/room.guard.ts b/openvidu-call-front/src/app/core/guards/room.guard.ts index dbebb7ae..c74b0cfa 100644 --- a/openvidu-call-front/src/app/core/guards/room.guard.ts +++ b/openvidu-call-front/src/app/core/guards/room.guard.ts @@ -2,13 +2,13 @@ import { inject } from '@angular/core'; import { ActivatedRouteSnapshot, Router, RouterStateSnapshot } from '@angular/router'; import { ConfigService } from '../services/config.service'; import { StorageService } from '../services/storage.service'; -import { RestService } from '../services/rest.service'; +import { HttpService } from '../services/http.service'; import { CanActivateFn } from '@angular/router'; export const roomGuard: CanActivateFn = async (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => { const configService = inject(ConfigService); const storageService = inject(StorageService); - const restService = inject(RestService); + const restService = inject(HttpService); const router = inject(Router); try { diff --git a/openvidu-call-front/src/app/core/services/config.service.ts b/openvidu-call-front/src/app/core/services/config.service.ts index bf6f25ea..898f5d2a 100644 --- a/openvidu-call-front/src/app/core/services/config.service.ts +++ b/openvidu-call-front/src/app/core/services/config.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { RestService } from './rest.service'; +import { HttpService } from '@services/http.service'; @Injectable({ providedIn: 'root' @@ -8,7 +8,7 @@ export class ConfigService { private config: { isPrivate: boolean }; private initialization: Promise; - constructor(private restService: RestService) {} + constructor(private restService: HttpService) {} async initialize(): Promise { if (!this.initialization) { diff --git a/openvidu-call-front/src/app/core/services/rest.service.ts b/openvidu-call-front/src/app/core/services/http.service.ts similarity index 99% rename from openvidu-call-front/src/app/core/services/rest.service.ts rename to openvidu-call-front/src/app/core/services/http.service.ts index bd309e98..3de25b82 100644 --- a/openvidu-call-front/src/app/core/services/rest.service.ts +++ b/openvidu-call-front/src/app/core/services/http.service.ts @@ -7,7 +7,7 @@ import { StorageService } from './storage.service'; @Injectable({ providedIn: 'root' }) -export class RestService { +export class HttpService { // private baseHref: string; private pathPrefix = 'call/api'; diff --git a/openvidu-call-front/src/app/pages/admin-dashboard/admin-dashboard.component.ts b/openvidu-call-front/src/app/pages/admin-dashboard/admin-dashboard.component.ts index 0f7772e1..c3d425e6 100644 --- a/openvidu-call-front/src/app/pages/admin-dashboard/admin-dashboard.component.ts +++ b/openvidu-call-front/src/app/pages/admin-dashboard/admin-dashboard.component.ts @@ -1,5 +1,5 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; -import { RestService } from '@services/rest.service'; +import { HttpService } from '@services/http.service'; import { StorageService } from '@services/storage.service'; import { OpenViduComponentsModule, ApiDirectiveModule } from 'openvidu-components-angular'; @@ -17,7 +17,7 @@ export class AdminDashboardComponent implements OnInit, OnDestroy { error: any; private continuationToken: string; constructor( - private restService: RestService, + private httpService: HttpService, private storageService: StorageService ) {} @@ -41,9 +41,9 @@ export class AdminDashboardComponent implements OnInit, OnDestroy { async onLoginClicked(credentials: { username: string; password: string }) { try { - await this.restService.adminLogin(credentials); + await this.httpService.adminLogin(credentials); this.storageService.setAdminCredentials(credentials); - const { recordings, continuationToken } = await this.restService.getRecordings(); + const { recordings, continuationToken } = await this.httpService.getRecordings(); this.recordings = recordings; this.continuationToken = continuationToken; this.isParticipantLoggedIn = true; @@ -60,7 +60,7 @@ export class AdminDashboardComponent implements OnInit, OnDestroy { this.storageService.clearAdminCredentials(); this.recordings = []; this.continuationToken = null; - await this.restService.adminLogout(); + await this.httpService.adminLogout(); } catch (error) { console.error(error); } @@ -69,14 +69,14 @@ export class AdminDashboardComponent implements OnInit, OnDestroy { async onLoadMoreRecordingsRequested() { if (!this.continuationToken) return console.warn('No more recordings to load'); - const response = await this.restService.getRecordings(this.continuationToken); + const response = await this.httpService.getRecordings(this.continuationToken); this.recordings = response.recordings; this.continuationToken = response.continuationToken; } async onRefreshRecordingsClicked() { try { - const response = await this.restService.getRecordings(); + const response = await this.httpService.getRecordings(); this.recordings = response.recordings; this.continuationToken = response.continuationToken; } catch (error) { @@ -86,8 +86,8 @@ export class AdminDashboardComponent implements OnInit, OnDestroy { async onDeleteRecordingClicked(recordingId: string) { try { - await this.restService.deleteRecordingByAdmin(recordingId); - const response = await this.restService.getRecordings(); + await this.httpService.deleteRecordingByAdmin(recordingId); + const response = await this.httpService.getRecordings(); this.recordings = response.recordings; this.continuationToken = response.continuationToken; } catch (error) { diff --git a/openvidu-call-front/src/app/pages/home/home.component.ts b/openvidu-call-front/src/app/pages/home/home.component.ts index c8526bb8..1df49084 100644 --- a/openvidu-call-front/src/app/pages/home/home.component.ts +++ b/openvidu-call-front/src/app/pages/home/home.component.ts @@ -17,7 +17,7 @@ import { ActivatedRoute, Router } from '@angular/router'; import { Subscription } from 'rxjs'; import { ConfigService } from '@services/config.service'; -import { RestService } from '@services/rest.service'; +import { HttpService } from '@services/http.service'; import { StorageService } from '@services/storage.service'; import packageInfo from '../../../../package.json'; @@ -55,7 +55,7 @@ export class HomeComponent implements OnInit, OnDestroy { constructor( private router: Router, public formBuilder: UntypedFormBuilder, - private restService: RestService, + private httpService: HttpService, private storageService: StorageService, private callService: ConfigService, private fb: FormBuilder, @@ -84,7 +84,7 @@ export class HomeComponent implements OnInit, OnDestroy { if (!userCredentials) return; - await this.restService.userLogin(userCredentials); + await this.httpService.userLogin(userCredentials); this.storageService.setUserCredentials(userCredentials); this.username = this.storageService.getUserName(); this.isUserLogged = true; @@ -126,7 +126,7 @@ export class HomeComponent implements OnInit, OnDestroy { const password = this.loginForm.get('password').value; try { - await this.restService.userLogin({ username: this.username, password }); + await this.httpService.userLogin({ username: this.username, password }); this.storageService.setUserCredentials({ username: this.username, password }); this.isUserLogged = true; } catch (error) { @@ -138,7 +138,7 @@ export class HomeComponent implements OnInit, OnDestroy { async logout() { try { - await this.restService.userLogout(); + await this.httpService.userLogout(); this.storageService.clearUserCredentials(); this.loginError = false; this.isUserLogged = false; diff --git a/openvidu-call-front/src/app/pages/video-room/video-room.component.ts b/openvidu-call-front/src/app/pages/video-room/video-room.component.ts index cd703979..4322aa21 100644 --- a/openvidu-call-front/src/app/pages/video-room/video-room.component.ts +++ b/openvidu-call-front/src/app/pages/video-room/video-room.component.ts @@ -11,7 +11,7 @@ import { } from 'openvidu-components-angular'; import { MatIcon } from '@angular/material/icon'; -import { RestService } from '@services/rest.service'; +import { HttpService } from '@services/http.service'; @Component({ selector: 'app-video-room', @@ -28,7 +28,7 @@ export class VideoRoomComponent implements OnInit { loading = true; constructor( - private restService: RestService, + private httpService: HttpService, private router: Router, private route: ActivatedRoute ) {} @@ -41,7 +41,7 @@ export class VideoRoomComponent implements OnInit { async onTokenRequested(participantName: string) { try { - const { token } = await this.restService.getToken(this.roomName, participantName); + const { token } = await this.httpService.getToken(this.roomName, participantName); this.token = token; } catch (error) { console.error(error); @@ -60,7 +60,7 @@ export class VideoRoomComponent implements OnInit { async onRecordingStartRequested(event: RecordingStartRequestedEvent) { try { const { roomName } = event; - await this.restService.startRecording(roomName); + await this.httpService.startRecording(roomName); } catch (error) { console.error(error); } @@ -72,7 +72,7 @@ export class VideoRoomComponent implements OnInit { if(!recordingId) throw new Error('Recording ID not found when stopping recording'); - await this.restService.stopRecording(recordingId); + await this.httpService.stopRecording(recordingId); } catch (error) { console.error(error); } @@ -84,7 +84,7 @@ export class VideoRoomComponent implements OnInit { if(!recordingId) throw new Error('Recording ID not found when deleting recording'); - await this.restService.deleteRecording(recordingId); + await this.httpService.deleteRecording(recordingId); } catch (error) { console.error(error); } @@ -93,7 +93,7 @@ export class VideoRoomComponent implements OnInit { async onBroadcastingStartRequested(event: BroadcastingStartRequestedEvent) { try { const { roomName, broadcastUrl } = event; - await this.restService.startBroadcasting(roomName, broadcastUrl); + await this.httpService.startBroadcasting(roomName, broadcastUrl); } catch (error) { console.error(error); } @@ -102,7 +102,7 @@ export class VideoRoomComponent implements OnInit { async onBroadcastingStopRequested(event: BroadcastingStopRequestedEvent) { try { const { broadcastingId } = event; - await this.restService.stopBroadcasting(broadcastingId); + await this.httpService.stopBroadcasting(broadcastingId); } catch (error) { console.error(error); }