Improve page

This commit is contained in:
Peter Maquiran
2021-03-31 16:32:33 +01:00
parent 4f443e36e2
commit 6c027b92e8
2 changed files with 8 additions and 8 deletions
+6 -6
View File
@@ -35,9 +35,7 @@ export class AuthService {
async login(user: User): Promise<boolean> {
user.BasicAuthKey = 'Basic ' + btoa(user.username + '@' + user.domainName + ':' + user.password); //conversão em base64 das credenciais inseridas
//if(!environment.production){
localStorage.setItem('user', JSON.stringify(user) );
//}
const options = { headers: {'Authorization': user.BasicAuthKey }};
this.headers = this.headers.set('Authorization',user.BasicAuthKey);
@@ -52,12 +50,14 @@ export class AuthService {
result = await this.http.get<boolean>(service, options).toPromise();
response = await this.http.post<any>(environment.apiURL + "UserAuthentication/Login", '', this.opts).toPromise();
console.log(response);
if (result)
{
this.ValidatedUser = user;
//if(!environment.production){
localStorage.setItem('user', JSON.stringify(Object.assign(user, response) ) );
//}
this.storageService.store(AuthConnstants.USER, response);
}
return result;