Исправил ошибки у новых пользователей
This commit is contained in:
gofnnp 2023-03-30 12:43:42 +04:00
parent 7bb05324a9
commit 7a9f9fc872
5 changed files with 78 additions and 70 deletions

View File

@ -17,12 +17,9 @@
<div class="info"> <div class="info">
<div *ngIf="accountData" class="row"> <div *ngIf="accountData" class="row">
<span class="key">Имя</span> <span class="key">Имя</span>
<span class="value" *ngIf="userName.length">{{ <span class="value">{{
userName userName && userName.length ? userName : 'Не задано'
}}</span> }}</span>
<span class="value" *ngIf="!userName.length"
>Не задано</span
>
</div> </div>
<div *ngIf="accountData" class="row"> <div *ngIf="accountData" class="row">
<span class="key">Баланс карты</span> <span class="key">Баланс карты</span>

View File

@ -92,9 +92,9 @@ export class BonusProgramComponent implements OnInit {
); );
this.accountData = getAccount && getAccount['Cards'][0]; this.accountData = getAccount && getAccount['Cards'][0];
this.bonuses = this.accountData.BonusProgramAccounts.reduce((previous, {Bonuses}) => { this.bonuses = this.accountData.BonusProgramAccounts?.reduce((previous, {Bonuses}) => {
return previous + Bonuses return previous + Bonuses
}, 0) }, 0) || this.accountData.Bonuses
this.loadingBonuses = false; this.loadingBonuses = false;
if (this.accountData) { if (this.accountData) {
barcode('#barcode') barcode('#barcode')

View File

@ -81,6 +81,7 @@
></p-progressSpinner> ></p-progressSpinner>
<p <p
*ngIf="purchases?.length === 0 && !ordersLoadingStatus" *ngIf="purchases?.length === 0 && !ordersLoadingStatus"
class="no-orders"
style="width: 100%; text-align: center" style="width: 100%; text-align: center"
> >
Нет заказов Нет заказов

View File

@ -48,7 +48,7 @@
color: #ed0000; color: #ed0000;
} }
&.green-color { &.green-color {
color: #00a700 color: #00a700;
} }
} }
&__cell-order-number a { &__cell-order-number a {
@ -68,3 +68,9 @@
text-align: center; text-align: center;
} }
} }
.no-orders {
width: 100%;
text-align: center;
margin-top: 16px;
}

View File

@ -34,6 +34,10 @@ export class UserDataComponent implements OnInit {
params: [] params: []
}, RpcService.authService, true).subscribe({ }, RpcService.authService, true).subscribe({
next: (res) => { next: (res) => {
if (res.code === 45) {
this.messageService.add({severity:'warn', summary:'Данные не найдены, заполните их на этой странице'});
return
}
if (!res.data) { if (!res.data) {
this.messageService.add({severity:'error', summary:'Произошла ошибка, попробуйте позже'}); this.messageService.add({severity:'error', summary:'Произошла ошибка, попробуйте позже'});
return return