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:
@@ -32,9 +32,8 @@ export class AuthService {
|
||||
}
|
||||
|
||||
public ValidatedUser:User;
|
||||
public ValidatedUser2:any;
|
||||
|
||||
async login(user: User): Promise<boolean> {
|
||||
async login(user: User) {
|
||||
this.alertCrontroller.presentAlert('1');
|
||||
user.BasicAuthKey = 'Basic ' + btoa(user.username + '@' + user.domainName + ':' + user.password); //conversão em base64 das credenciais inseridas
|
||||
|
||||
@@ -48,34 +47,27 @@ export class AuthService {
|
||||
let result: boolean | PromiseLike<boolean>;
|
||||
let response: any;
|
||||
|
||||
this.alertCrontroller.presentAlert('2');
|
||||
/* this.alertCrontroller.presentAlert('2');
|
||||
this.http.get('http://jsonplaceholder.typicode.com/todos/1');
|
||||
this.alertCrontroller.presentAlert('2.1');
|
||||
this.http.get('https://jsonplaceholder.typicode.com/todos/1');
|
||||
this.alertCrontroller.presentAlert('2.2');
|
||||
var that = this;
|
||||
var that = this; */
|
||||
|
||||
await this.http.get<boolean>(service, options).subscribe(res=>{
|
||||
this.alertCrontroller.presentAlert('3.1');
|
||||
//this.alertCrontroller.presentAlert('3.1');
|
||||
result = res;
|
||||
this.storage.set('login', res);
|
||||
|
||||
|
||||
return result;
|
||||
if (result)
|
||||
{
|
||||
this.alertCrontroller.presentAlert('4');
|
||||
if (result){
|
||||
//this.alertCrontroller.presentAlert('4');
|
||||
this.ValidatedUser = user;
|
||||
//this.storageService.store(AuthConnstants.USER, response);
|
||||
}
|
||||
|
||||
});
|
||||
this.storage.get('name').then((val) => {
|
||||
console.log('Your age is', val);
|
||||
});
|
||||
|
||||
|
||||
this.alertCrontroller.presentAlert('3');
|
||||
//this.alertCrontroller.presentAlert('3');
|
||||
response = await this.http.post<any>(environment.apiURL + "UserAuthentication/Login", '', this.opts).toPromise();
|
||||
console.log(response);
|
||||
|
||||
@@ -90,17 +82,7 @@ export class AuthService {
|
||||
.then((val) => {
|
||||
return val;
|
||||
}); */
|
||||
|
||||
let t = this.get('name');
|
||||
|
||||
console.log(this.ValidatedUser2);
|
||||
|
||||
|
||||
|
||||
|
||||
console.log(this.rs.map(responce=>responce.json()).toPromise());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
async get(key: string): Promise<any> {
|
||||
@@ -108,8 +90,7 @@ export class AuthService {
|
||||
const result = await this.storage.get(key);
|
||||
console.log('storageGET: ' + key + ': ' + result);
|
||||
if (result != null) {
|
||||
this.ValidatedUser2 = result;
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
} catch (reason) {
|
||||
|
||||
Reference in New Issue
Block a user