Frontend #171
@@ -16,7 +16,10 @@ export class ProfileComponent implements OnInit {
 | 
			
		||||
    Validators.required,
 | 
			
		||||
    Validators.minLength(6),
 | 
			
		||||
  ]);
 | 
			
		||||
  telegramIdFormControl = new FormControl('', [Validators.required]);
 | 
			
		||||
  telegramIdFormControl = new FormControl('', [
 | 
			
		||||
    Validators.required,
 | 
			
		||||
    Validators.minLength(6),
 | 
			
		||||
  ]);
 | 
			
		||||
 | 
			
		||||
  userId = '';
 | 
			
		||||
 | 
			
		||||
@@ -32,9 +35,6 @@ export class ProfileComponent implements OnInit {
 | 
			
		||||
  ) {}
 | 
			
		||||
 | 
			
		||||
  ngOnInit(): void {
 | 
			
		||||
    /**
 | 
			
		||||
     * get user data to display
 | 
			
		||||
     */
 | 
			
		||||
    this.profileService.getUserData().subscribe((result) => {
 | 
			
		||||
      console.log(result);
 | 
			
		||||
      result = JSON.parse(result);
 | 
			
		||||
@@ -45,21 +45,17 @@ export class ProfileComponent implements OnInit {
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Add telegram user id in database
 | 
			
		||||
   */
 | 
			
		||||
  onSubmit() {
 | 
			
		||||
    if (this.userId != '') {
 | 
			
		||||
      console.log(this.userId);
 | 
			
		||||
      this.profileService.addTelegramId(this.userId).subscribe((result) => {
 | 
			
		||||
      this.profileService
 | 
			
		||||
        .addTelegramId('' + this.userId)
 | 
			
		||||
        .subscribe((result) => {
 | 
			
		||||
          console.log(result);
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Function to update user information
 | 
			
		||||
   */
 | 
			
		||||
  updateUser() {
 | 
			
		||||
    const { username, email, password } = this.form;
 | 
			
		||||
    this.profileService
 | 
			
		||||
@@ -69,14 +65,12 @@ export class ProfileComponent implements OnInit {
 | 
			
		||||
      });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // opens confirmation dialog
 | 
			
		||||
  openDialog(action: string) {
 | 
			
		||||
    const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
 | 
			
		||||
      width: '50vw',
 | 
			
		||||
      height: '20vh',
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // on close dialog, if action is "addTelegram" update telegram id, else update user information
 | 
			
		||||
    dialogRef.afterClosed().subscribe((result) => {
 | 
			
		||||
      if (result === true) {
 | 
			
		||||
        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() {
 | 
			
		||||
    const dialogRef = this.dialog.open(HelpDialogComponent, {
 | 
			
		||||
      width: '50vw',
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user