Aktualisierung der GroupOfUser-, User- und UserRep-Controller. Aktualisieren Sie Agular-Referenzen und entfernen Sie Konsolenprotokolle.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { Inject, Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { AuthCheckDto } from '../models/user-management.api.models';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Router } from '@angular/router';
|
||||
import Swal from 'sweetalert2';
|
||||
|
||||
@@ -9,15 +8,20 @@ import Swal from 'sweetalert2';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class AuthenticationService {
|
||||
constructor(private router: Router, private http: HttpClient, @Inject('LOGIN_URL') private loginUrl: string, @Inject('LOGOUT_URL') private logoutUrl: string, @Inject('LOGIN_CHECK_URL') private checkUrl: string) { }
|
||||
constructor(
|
||||
private router: Router,
|
||||
private http: HttpClient,
|
||||
@Inject('LOGIN_URL') private loginUrl: string,
|
||||
@Inject('LOGOUT_URL') private logoutUrl: string,
|
||||
@Inject('LOGIN_CHECK_URL') private checkUrl: string) { }
|
||||
|
||||
isAuthenticated(): Observable<boolean> {
|
||||
return new Observable(observer => {
|
||||
this.http.get<AuthCheckDto>(this.checkUrl, { withCredentials: true })
|
||||
this.http.get<boolean>(this.checkUrl, { withCredentials: true })
|
||||
.subscribe({
|
||||
next: (response) => {
|
||||
_isLogedIn = response.isAuthenticated;
|
||||
observer.next(response.isAuthenticated)
|
||||
_isLogedIn = response;
|
||||
observer.next(response)
|
||||
},
|
||||
error: (error) => {
|
||||
this.showErrorAlert()
|
||||
@@ -54,11 +58,9 @@ export class AuthenticationService {
|
||||
this.http.post<any>(this.logoutUrl, {}, { withCredentials: true })
|
||||
.subscribe({
|
||||
next: (response) => {
|
||||
if (response.ok) {
|
||||
this.router.navigate(['/']);
|
||||
_isLogedIn = false;
|
||||
observer.next(response)
|
||||
}
|
||||
this.router.navigate(['/']);
|
||||
_isLogedIn = false;
|
||||
observer.next(response)
|
||||
},
|
||||
error: (error) => observer.error(error),
|
||||
complete: () => observer.complete()
|
||||
|
||||
@@ -23,7 +23,6 @@ export class UserService extends ApiService<User> {
|
||||
}
|
||||
|
||||
createByDir(createModel: DirUser): Observable<DirUser> {
|
||||
console.log(createModel)
|
||||
return this.http.post<DirUser>(`${this.baseUrl}/byDir`, createModel, { withCredentials: true });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user