dev #14384 Правка ошибок отображения WPA КофеЛайк: fix last purchase

This commit is contained in:
nikolay 2023-06-26 10:24:18 +04:00
parent 7fa882e423
commit 8ea4a41786
2 changed files with 11 additions and 8 deletions

View File

@ -6,7 +6,6 @@ import { MessageService } from 'primeng/api';
import { MessagingService } from 'src/app/services/messaging.service'; import { MessagingService } from 'src/app/services/messaging.service';
import { DeviceType, getTypeDevice } from 'src/app/utils'; import { DeviceType, getTypeDevice } from 'src/app/utils';
import { AuthService } from 'src/app/services/auth.service'; import { AuthService } from 'src/app/services/auth.service';
import { ResponseError } from 'src/app/interface/data';
@Component({ @Component({
selector: 'app-guest-card', selector: 'app-guest-card',
@ -36,6 +35,8 @@ export class GuestCardComponent implements OnInit {
this.negativeBalance = !Array.isArray(this.authService.userInfo?.walletBalances); this.negativeBalance = !Array.isArray(this.authService.userInfo?.walletBalances);
this.showBack = getTypeDevice() === DeviceType.android; this.showBack = getTypeDevice() === DeviceType.android;
this.authService.getLastPurchase();
this.requestPermission(); this.requestPermission();
} }

View File

@ -244,12 +244,14 @@ export class AuthService {
return this.userInfo && lvlPeriods[this.userInfo?.customer_level] || lvlPeriods[0]; return this.userInfo && lvlPeriods[this.userInfo?.customer_level] || lvlPeriods[0];
} }
getLastPurchase(userInfo: UserInfo) { getLastPurchase() {
this.wpJsonService.getLastPurchase(environment.systemId, this.token!).subscribe({ if(this.userInfo) {
next: (res) => { this.wpJsonService.getLastPurchase(environment.systemId, this.token!).subscribe({
this.purchaseData.lastPurchase = res[userInfo.id][0]; next: (res) => {
}, this.purchaseData.lastPurchase = res[this.userInfo!.id][0];
}); },
});
}
} }
getBalanceAmount(loyaltyPrograms: UserInfoWalletBalance[]) { getBalanceAmount(loyaltyPrograms: UserInfoWalletBalance[]) {