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

View File

@ -87,7 +87,7 @@ export class AuthService {
});
} else if (value && value.customer_info) {
this.userInfo = value.customer_info;
this.cookiesService.setCookie('phone-number', this.userInfo!.phone?.slice(2));
}
},
@ -244,12 +244,14 @@ export class AuthService {
return this.userInfo && lvlPeriods[this.userInfo?.customer_level] || lvlPeriods[0];
}
getLastPurchase(userInfo: UserInfo) {
this.wpJsonService.getLastPurchase(environment.systemId, this.token!).subscribe({
next: (res) => {
this.purchaseData.lastPurchase = res[userInfo.id][0];
},
});
getLastPurchase() {
if(this.userInfo) {
this.wpJsonService.getLastPurchase(environment.systemId, this.token!).subscribe({
next: (res) => {
this.purchaseData.lastPurchase = res[this.userInfo!.id][0];
},
});
}
}
getBalanceAmount(loyaltyPrograms: UserInfoWalletBalance[]) {