frontend: Refactor HttpService to call new auth endpoints
This commit is contained in:
parent
eefe90cf5a
commit
081722d63c
@ -1,7 +1,7 @@
|
|||||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { OpenViduMeetRoom, OpenViduMeetRoomOptions } from 'projects/shared-meet-components/src/lib/typings/ce/room';
|
import { OpenViduMeetRoom, OpenViduMeetRoomOptions } from 'projects/shared-meet-components/src/lib/typings/ce/room';
|
||||||
import { GlobalPreferences, RoomPreferences, TokenOptions } from '@lib/typings/ce';
|
import { GlobalPreferences, RoomPreferences, TokenOptions, User } from '@lib/typings/ce';
|
||||||
import { RecordingInfo, Room } from 'openvidu-components-angular';
|
import { RecordingInfo, Room } from 'openvidu-components-angular';
|
||||||
import { lastValueFrom } from 'rxjs';
|
import { lastValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@ -75,30 +75,22 @@ export class HttpService {
|
|||||||
return this.putRequest(`${this.pathPrefix}/preferences/room`, preferences);
|
return this.putRequest(`${this.pathPrefix}/preferences/room`, preferences);
|
||||||
}
|
}
|
||||||
|
|
||||||
adminLogin(body: { username: string; password: string }): Promise<{ message: string }> {
|
login(body: { username: string; password: string }): Promise<{ message: string }> {
|
||||||
return this.postRequest(`${this.pathPrefix}/${this.apiVersion}/auth/admin/login`, body);
|
|
||||||
}
|
|
||||||
|
|
||||||
adminLogout(): Promise<{ message: string }> {
|
|
||||||
return this.postRequest(`${this.pathPrefix}/${this.apiVersion}/auth/admin/logout`);
|
|
||||||
}
|
|
||||||
|
|
||||||
adminRefresh(): Promise<{ message: string }> {
|
|
||||||
return this.postRequest(`${this.pathPrefix}/${this.apiVersion}/auth/admin/refresh`);
|
|
||||||
}
|
|
||||||
|
|
||||||
adminVerify(): Promise<{ message: string }> {
|
|
||||||
return this.getRequest(`${this.pathPrefix}/${this.apiVersion}/auth/admin/verify`);
|
|
||||||
}
|
|
||||||
|
|
||||||
userLogin(body: { username: string; password: string }): Promise<{ message: string }> {
|
|
||||||
return this.postRequest(`${this.pathPrefix}/${this.apiVersion}/auth/login`, body);
|
return this.postRequest(`${this.pathPrefix}/${this.apiVersion}/auth/login`, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
userLogout(): Promise<{ message: string }> {
|
logout(): Promise<{ message: string }> {
|
||||||
return this.postRequest(`${this.pathPrefix}/${this.apiVersion}/auth/logout`);
|
return this.postRequest(`${this.pathPrefix}/${this.apiVersion}/auth/logout`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
refreshToken(): Promise<{ message: string }> {
|
||||||
|
return this.postRequest(`${this.pathPrefix}/${this.apiVersion}/auth/refresh`);
|
||||||
|
}
|
||||||
|
|
||||||
|
getProfile(): Promise<User> {
|
||||||
|
return this.getRequest(`${this.pathPrefix}/${this.apiVersion}/auth/profile`);
|
||||||
|
}
|
||||||
|
|
||||||
getRecordings(continuationToken?: string): Promise<{ recordings: RecordingInfo[]; continuationToken: string }> {
|
getRecordings(continuationToken?: string): Promise<{ recordings: RecordingInfo[]; continuationToken: string }> {
|
||||||
let path = `${this.pathPrefix}/${this.apiVersion}/recordings`;
|
let path = `${this.pathPrefix}/${this.apiVersion}/recordings`;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user