diff --git a/angular/src/app/presentation-options/default-option/pages/login/login.component.html b/angular/src/app/presentation-options/default-option/pages/login/login.component.html index 68842b1..58ad660 100644 --- a/angular/src/app/presentation-options/default-option/pages/login/login.component.html +++ b/angular/src/app/presentation-options/default-option/pages/login/login.component.html @@ -41,7 +41,7 @@ Используя приложение, вы принимаете условия и соглашаетесь на получение рекламно-информационных сообщений

- + diff --git a/angular/src/app/presentation-options/default-option/pages/login/login.component.scss b/angular/src/app/presentation-options/default-option/pages/login/login.component.scss index f422997..7e84dfd 100644 --- a/angular/src/app/presentation-options/default-option/pages/login/login.component.scss +++ b/angular/src/app/presentation-options/default-option/pages/login/login.component.scss @@ -5,6 +5,8 @@ align-items: center; max-width: 600px; margin: 0 auto 52px; + padding-left: 20px; + padding-right: 20px; h1 { margin-top: 20px; diff --git a/angular/src/app/presentation-options/default-option/pages/login/login.component.ts b/angular/src/app/presentation-options/default-option/pages/login/login.component.ts index 88a1f40..6e19ef2 100644 --- a/angular/src/app/presentation-options/default-option/pages/login/login.component.ts +++ b/angular/src/app/presentation-options/default-option/pages/login/login.component.ts @@ -8,6 +8,7 @@ import { import { FormControl, FormGroup, Validators } from '@angular/forms'; import { Router } from '@angular/router'; import { AuthService } from 'src/app/services/auth.service'; +import { MessageService } from 'primeng/api'; @Component({ selector: 'app-login', @@ -17,7 +18,7 @@ import { AuthService } from 'src/app/services/auth.service'; export class LoginComponent implements OnInit { public isShowNumber: boolean = true; public phoneForm = new FormGroup({ - name: new FormControl('', []), + name: new FormControl('', [Validators.required]), phone: new FormControl('', [Validators.required]), }); public codeForm = new FormGroup({ @@ -31,6 +32,7 @@ export class LoginComponent implements OnInit { constructor( public authService: AuthService, private router: Router, + private messageService: MessageService, ) { } ngOnInit(): void { } @@ -102,6 +104,12 @@ export class LoginComponent implements OnInit { if (this.phoneForm.invalid) { this.phoneForm.markAsTouched(); + this.messageService.add({ + severity: 'error', + summary: 'Введите имя и телефон', + life: 5000, + }); + return; } const data = this.phoneForm.value; diff --git a/angular/src/app/services/auth.service.ts b/angular/src/app/services/auth.service.ts index e1b434a..2b068d3 100644 --- a/angular/src/app/services/auth.service.ts +++ b/angular/src/app/services/auth.service.ts @@ -90,7 +90,7 @@ export class AuthService { this.cookiesService.setCookie('phone-number', this.userInfo!.phone?.slice(2)); - this.getLastPurchase(); + this.getLastPurchase(); } }, error: (e) => { @@ -247,13 +247,13 @@ export class AuthService { } getLastPurchase() { - if(this.userInfo) { - this.wpJsonService.getLastPurchase(environment.systemId, this.token!).subscribe({ - next: (res) => { - this.purchaseData.lastPurchase = res[this.userInfo!.id][0]; - }, - }); - } + if (this.userInfo) { + this.wpJsonService.getLastPurchase(environment.systemId, this.token!).subscribe({ + next: (res) => { + this.purchaseData.lastPurchase = res[this.userInfo!.id][0]; + }, + }); + } } getBalanceAmount(loyaltyPrograms: UserInfoWalletBalance[]) {