fix id bug
This commit is contained in:
parent
0fc9e8d37f
commit
5d266dfdaf
@ -16,7 +16,10 @@ export class ProfileComponent implements OnInit {
|
|||||||
Validators.required,
|
Validators.required,
|
||||||
Validators.minLength(6),
|
Validators.minLength(6),
|
||||||
]);
|
]);
|
||||||
telegramIdFormControl = new FormControl('', [Validators.required]);
|
telegramIdFormControl = new FormControl('', [
|
||||||
|
Validators.required,
|
||||||
|
Validators.minLength(6),
|
||||||
|
]);
|
||||||
|
|
||||||
userId = '';
|
userId = '';
|
||||||
|
|
||||||
@ -32,9 +35,6 @@ export class ProfileComponent implements OnInit {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
/**
|
|
||||||
* get user data to display
|
|
||||||
*/
|
|
||||||
this.profileService.getUserData().subscribe((result) => {
|
this.profileService.getUserData().subscribe((result) => {
|
||||||
console.log(result);
|
console.log(result);
|
||||||
result = JSON.parse(result);
|
result = JSON.parse(result);
|
||||||
@ -45,21 +45,17 @@ export class ProfileComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Add telegram user id in database
|
|
||||||
*/
|
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
if (this.userId != '') {
|
if (this.userId != '') {
|
||||||
console.log(this.userId);
|
console.log(this.userId);
|
||||||
this.profileService.addTelegramId(this.userId).subscribe((result) => {
|
this.profileService
|
||||||
|
.addTelegramId('' + this.userId)
|
||||||
|
.subscribe((result) => {
|
||||||
console.log(result);
|
console.log(result);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Function to update user information
|
|
||||||
*/
|
|
||||||
updateUser() {
|
updateUser() {
|
||||||
const { username, email, password } = this.form;
|
const { username, email, password } = this.form;
|
||||||
this.profileService
|
this.profileService
|
||||||
@ -69,14 +65,12 @@ export class ProfileComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// opens confirmation dialog
|
|
||||||
openDialog(action: string) {
|
openDialog(action: string) {
|
||||||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||||
width: '50vw',
|
width: '50vw',
|
||||||
height: '20vh',
|
height: '20vh',
|
||||||
});
|
});
|
||||||
|
|
||||||
// on close dialog, if action is "addTelegram" update telegram id, else update user information
|
|
||||||
dialogRef.afterClosed().subscribe((result) => {
|
dialogRef.afterClosed().subscribe((result) => {
|
||||||
if (result === true) {
|
if (result === true) {
|
||||||
if (action === 'addTelegram') {
|
if (action === 'addTelegram') {
|
||||||
@ -88,7 +82,6 @@ export class ProfileComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// helper user dialog to explain the process of getting the telegram id
|
|
||||||
openHelp() {
|
openHelp() {
|
||||||
const dialogRef = this.dialog.open(HelpDialogComponent, {
|
const dialogRef = this.dialog.open(HelpDialogComponent, {
|
||||||
width: '50vw',
|
width: '50vw',
|
||||||
|
Loading…
Reference in New Issue
Block a user