From 9782c919d5d64d23257e43a5f9a69aa703f212fa Mon Sep 17 00:00:00 2001 From: Spencer Ofwiti Date: Wed, 26 May 2021 10:26:11 +0300 Subject: [PATCH] Refactor calls to ussd service. --- src/app/_services/user.service.ts | 2 +- .../accounts/account-details/account-details.component.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/_services/user.service.ts b/src/app/_services/user.service.ts index ff1adf0..cc9685e 100644 --- a/src/app/_services/user.service.ts +++ b/src/app/_services/user.service.ts @@ -52,7 +52,7 @@ export class UserService { resetPin(phone: string): Observable { const params: HttpParams = new HttpParams().set('phoneNumber', phone); - return this.httpClient.get(`${environment.cicUssdUrl}/pin`, { params }); + return this.httpClient.put(`${environment.cicUssdUrl}/pin`, { params }); } getAccountStatus(phone: string): Observable { diff --git a/src/app/pages/accounts/account-details/account-details.component.ts b/src/app/pages/accounts/account-details/account-details.component.ts index dedcc42..e7e01f3 100644 --- a/src/app/pages/accounts/account-details/account-details.component.ts +++ b/src/app/pages/accounts/account-details/account-details.component.ts @@ -109,8 +109,6 @@ export class AccountDetailsComponent implements OnInit { this.account = res; this.cdr.detectChanges(); this.loggingService.sendInfoLevelMessage(this.account); - // this.userService.getAccountStatus(this.account.vcard?.tel[0].value).pipe(first()) - // .subscribe(response => this.accountStatus = response); this.accountInfoForm.patchValue({ name: this.account.vcard?.fn[0].value, phoneNumber: this.account.vcard?.tel[0].value, @@ -123,6 +121,8 @@ export class AccountDetailsComponent implements OnInit { location: this.account.location.area, locationType: this.account.location.area_type, }); + this.userService.getAccountStatus(this.account.vcard?.tel[0].value).pipe(first()) + .subscribe(response => this.accountStatus = response.status); } else { alert('Account not found!'); }