Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 9cc55d8d

Přidáno uživatelem Václav Jirák před téměř 6 roky(ů)

Re #7534 'Profile settings' component connected to the API

Zobrazit rozdíly:

webapp/src/app/header/header.component.ts
3 3
import {LocalizationService} from '../localization/localization.service';
4 4
import {UserService} from '../services/api/user.service';
5 5
import {UserProfile} from '../models/user.model';
6
import {ProfileSettingsComponent} from "../profile-settings/profile-settings.component";
6 7

  
7 8
@Component({
8 9
  selector: 'app-header',
......
22 23
  }
23 24

  
24 25
  onProfileClick(): void {
25
    // TODO (až bude hotovej endpoint na post notifikace)
26
    // this.dialog.open(ProfileSettingsComponent, {
27
    //   data: {
28
    //     notifyDate: this.notificationSettings,
29
    //     notifyTime: {
30
    //       hour: this.notificationSettings.getHours(),
31
    //       minute: this.notificationSettings.getMinutes()
32
    //     }
33
    //   }
34
    // });
26
    this.userService.getLoggedUserProfile()
27
      .subscribe((data: UserProfile) => {
28
        this.profile = data;
29

  
30
        this.dialog.open(ProfileSettingsComponent, {
31
          data: {
32
            notification: this.profile.notification
33
          }
34
        }).afterClosed().subscribe(dialogData => {
35
          this.userService.putNotificationSettingsWithLanguage(
36
            {
37
              notification: dialogData.notification
38
            },
39
            this.localizationService.getCurrentLanguage()
40
          ).subscribe(() => {
41
            this.userService.getLoggedUserProfile().subscribe((profile: UserProfile) => this.profile = profile);
42
          });
43
        });
44
      });
35 45
  }
36 46
}

Také k dispozici: Unified diff