mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
save
This commit is contained in:
@@ -51,29 +51,35 @@ export class AuthService {
|
||||
}
|
||||
const service = environment.apiURL + "userauthentication/GetValidateAuth";
|
||||
|
||||
let result: boolean | PromiseLike<boolean>;
|
||||
let result: boolean | PromiseLike<boolean> = false;
|
||||
let response: any;
|
||||
|
||||
result = await this.http.get<boolean>(service, options).toPromise();
|
||||
response = await this.http.post<User>(environment.apiURL + "UserAuthentication/Login", '', this.opts).toPromise();
|
||||
try {
|
||||
result = await this.http.get<boolean>(service, options).toPromise();
|
||||
response = await this.http.post<User>(environment.apiURL + "UserAuthentication/Login", '', this.opts).toPromise();
|
||||
|
||||
console.log(response)
|
||||
console.log(response);
|
||||
|
||||
if (result) {
|
||||
if (result) {
|
||||
if( response.RoleID == 100000014) {
|
||||
response.Profile = 'PR'
|
||||
} else if(response.RoleID == 100000011) {
|
||||
response.Profile = 'MDGPR'
|
||||
}
|
||||
response.BasicAuthKey = user.BasicAuthKey
|
||||
this.ValidatedUser = response;
|
||||
|
||||
if( response.RoleID == 100000014) {
|
||||
response.Profile = 'PR'
|
||||
} else if(response.RoleID == 100000011) {
|
||||
response.Profile = 'MDGPR'
|
||||
localStorage.setItem('user', JSON.stringify(response));
|
||||
|
||||
this.storageService.store(AuthConnstants.USER, response);
|
||||
|
||||
return result;
|
||||
}
|
||||
response.BasicAuthKey = user.BasicAuthKey
|
||||
this.ValidatedUser = response;
|
||||
|
||||
localStorage.setItem('user', JSON.stringify(response));
|
||||
|
||||
this.storageService.store(AuthConnstants.USER, response);
|
||||
|
||||
} catch (error) {
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
logout(){
|
||||
|
||||
Reference in New Issue
Block a user