Gentlemen, please help me rewrite this method asynchronously so that the Observable> object is returned, and not just
ServiceResult.
public getAccount(login: string, password: string): ServiceResult<Account> { let token: string; let role: string; let code: number; this.http .post(this.url, new InputUser(login, password)) .subscribe((data: any) => { token = data.access_token; role = data.username; }, (error) => { code = error.statusCode }); var result = new ServiceResult<Account>(); if (code == 200) { result.data = new Account(token, role); } else { result.isError = true; } return result; } Thank.