rdt-client/client/src/app/auth.service.ts
Roger Far fc15569e1b Rewrote the setting store, retrieve and displaying on the settings page to make maintenance a lot easier.
Added settings to set defaults for the provider import, sonarr, gui and watch folders.
2022-05-13 14:39:52 -06:00

46 lines
1.2 KiB
TypeScript

import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/internal/Observable';
@Injectable({
providedIn: 'root',
})
export class AuthService {
constructor(private http: HttpClient) {}
public isLoggedIn(): Observable<void> {
return this.http.get<void>(`/Api/Authentication/IsLoggedIn`);
}
public create(userName: string, password: string): Observable<void> {
return this.http.post<void>(`/Api/Authentication/Create`, {
userName,
password,
});
}
public setupProvider(provider: string, token: string): Observable<void> {
return this.http.post<void>(`/Api/Authentication/SetupProvider`, {
provider,
token,
});
}
public login(userName: string, password: string): Observable<void> {
return this.http.post<void>(`/Api/Authentication/Login`, {
userName,
password,
});
}
public logout() {
return this.http.post<void>(`/Api/Authentication/Logout`, {});
}
public update(userName: string, password: string): Observable<void> {
return this.http.post<void>(`/Api/Authentication/Update`, {
userName,
password,
});
}
}