From c9bcf3fc15e42f6825a1aa04601b46101af6f0c3 Mon Sep 17 00:00:00 2001 From: nikolay Date: Tue, 27 Jun 2023 14:22:52 +0400 Subject: [PATCH] =?UTF-8?q?dev=20#14384=20=D0=9F=D1=80=D0=B0=D0=B2=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BE=D0=BA=20=D0=BE=D1=82?= =?UTF-8?q?=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D1=8F=20WPA=20?= =?UTF-8?q?=D0=9A=D0=BE=D1=84=D0=B5=D0=9B=D0=B0=D0=B9=D0=BA:=20fix=20login?= =?UTF-8?q?=20form?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/login/login.component.html | 2 +- .../pages/login/login.component.scss | 2 ++ .../pages/login/login.component.ts | 10 +++++++++- angular/src/app/services/auth.service.ts | 16 ++++++++-------- 4 files changed, 20 insertions(+), 10 deletions(-) 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[]) {