fix: redesign the service for a new api

This commit is contained in:
Polianin Nikita 2024-12-23 06:45:19 +03:00
parent 7830c5f21d
commit 135570d384

View File

@ -5,6 +5,8 @@ import {catchError, map, Observable, of} from "rxjs";
import {AuthRoles} from "@model/authRoles"; import {AuthRoles} from "@model/authRoles";
import {AvailableOAuthProvidersResponse} from "@api/v1/availableProvidersResponse"; import {AvailableOAuthProvidersResponse} from "@api/v1/availableProvidersResponse";
import {OAuthProvider} from "@model/oAuthProvider"; import {OAuthProvider} from "@model/oAuthProvider";
import {TwoFactorAuthentication} from "@model/twoFactorAuthentication";
import {TwoFactorAuthRequest} from "@api/v1/twoFactorAuthRequest";
export interface OAuthProviderData extends AvailableOAuthProvidersResponse { export interface OAuthProviderData extends AvailableOAuthProvidersResponse {
icon: string; icon: string;
@ -22,7 +24,17 @@ export default class AuthApiService extends ApiService {
.setWithCredentials() .setWithCredentials()
.build; .build;
return this.post<AuthRoles>(request); return this.post<TwoFactorAuthentication>(request);
}
public twoFactorAuth(data: TwoFactorAuthRequest) {
let request = this.createRequestBuilder()
.setEndpoint('2FA')
.setData(data)
.setWithCredentials()
.build;
return this.post<boolean>(request);
} }
public reLogin() { public reLogin() {