Projekt

Obecné

Profil

« Předchozí | Další » 

Revize cbb91c90

Přidáno uživatelem Jakub Hlaváč před téměř 4 roky(ů)

Re #8915 - Zapracování požadavků ze schůzky

+ sensor edit under edit button in menu
  • request for sensor data only for first time, then after button click
    + sensor group names
    + adding information to unit and sensor
    + commenting
    + code refactor

Zobrazit rozdíly:

src/app/auth/services/auth.service.ts
24 24
  ) {
25 25
  }
26 26

  
27
  /**
28
   * Set state from saved cookies
29
   */
27 30
  setFromCookie() {
28 31
    const user: User = {
29 32
      userCookie: {
......
37 40
    this.userState.setUser(user);
38 41
  }
39 42

  
43
  /**
44
   * Get user from state
45
   */
40 46
  getUser() {
41 47
    console.log('Auth Service');
42 48
    if (!this.userState.getUser() && this.cookieService.get(GlobalVariable.SESSION_ID)) {
......
46 52
    return this.userState.getUser();
47 53
  }
48 54

  
55
  /**
56
   * Get user from state as observable
57
   */
49 58
  getUserState(): Observable<User> {
50 59
    return this.userState.getUser$();
51 60
  }
52 61

  
62
  /**
63
   * Login process with backend call
64
   * @param loginInput login form
65
   */
53 66
  doLogin(loginInput): Observable<boolean> {
54 67
    return this.loginService.login$Response(loginInput)
55 68
      .pipe(
......
61 74
      );
62 75
  }
63 76

  
77
  /**
78
   * Set user state, cookie and localStorage from server response
79
   * @param userCookie server response
80
   * @param username form username
81
   */
64 82
  setUserFromResponse(userCookie: UserCookie, username): UserCookie {
65 83
    console.log('Setting user from login!');
66 84
    this.userState.setUser({
......
71 89
    return userCookie;
72 90
  }
73 91

  
92
  /**
93
   * Logout user, clear user state and redirect to login
94
   */
74 95
  doLogout() {
75 96
    this.userState.setUser(null);
76 97
    this.cookieService.deleteAll();
......
79 100
    this.cookieService.deleteAll();
80 101
  }
81 102

  
103
  /**
104
   * Set localstorage and cookies
105
   * @param userCookie user obejct
106
   * @param username username from login form
107
   */
82 108
  setSessionStorage(userCookie: UserCookie, username) {
83 109
    localStorage.setItem(GlobalVariable.USER_NAME, username)
84 110
    localStorage.setItem(GlobalVariable.RIGHTS, userCookie.rightsID.toString());

Také k dispozici: Unified diff