add parenthesis
This commit is contained in:
parent
4ddbdb1c75
commit
0f2a22c1e8
1 changed files with 17 additions and 20 deletions
|
|
@ -1,9 +1,6 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import {Observable} from "rxjs";
|
import {Observable} from "rxjs";
|
||||||
import {JSdata, MessageService} from "../message/message.service";
|
import {JSdata, MessageService} from "../message/message.service";
|
||||||
import {HttpClient} from "@angular/common/http";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
|
|
@ -14,29 +11,29 @@ export class AuthService {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
islog: boolean;
|
islog: boolean;
|
||||||
|
|
||||||
|
constructor(private messageService: MessageService) { }
|
||||||
|
|
||||||
constructor(
|
getLogged(): boolean {
|
||||||
private http: HttpClient,
|
return this.islog;
|
||||||
private MS: MessageService
|
}
|
||||||
) {}
|
|
||||||
|
setLogged(value: boolean): void {
|
||||||
|
this.islog = value;
|
||||||
|
}
|
||||||
|
|
||||||
sendAuthentication(login: string, password: string): Observable<JSdata> {
|
sendAuthentication(login: string, password: string): Observable<JSdata> {
|
||||||
const data = new FormData();
|
return this.messageService.sendMessage('checkLogin', {
|
||||||
if (login !== null && login !== undefined && password !== null && password !== undefined) {
|
'login': login,
|
||||||
data.append(login, password);
|
'password': password
|
||||||
}
|
|
||||||
return this.MS.sendMessage('checkLogin', {
|
|
||||||
login : login,
|
|
||||||
Password: password
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
finalizeAuthentication(data: JSdata): void {
|
finalizeAuthentication(data: JSdata): void {
|
||||||
if (data.status === 'ok'){
|
if (data.status === 'ok'){
|
||||||
this.islog = true;
|
this.setLogged(true);
|
||||||
} else {
|
}
|
||||||
this.islog = false;
|
else{
|
||||||
|
this.setLogged(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in a new issue