Revize b5525aef
Přidáno uživatelem Jakub Hlaváč před více než 3 roky(ů)
src/app/auth/states/user.state.ts | ||
---|---|---|
3 | 3 |
import {User} from '../models/user'; |
4 | 4 |
import {AuthService} from '../services/auth.service'; |
5 | 5 |
import {LoginService} from '../../shared/api/endpoints/services/login.service'; |
6 |
import {ToastService} from '../../shared/services/toast.service'; |
|
6 | 7 |
|
7 | 8 |
@Injectable({ |
8 | 9 |
providedIn: 'root' |
... | ... | |
11 | 12 |
private userState$: BehaviorSubject<User> = new BehaviorSubject<User>(null); |
12 | 13 |
|
13 | 14 |
constructor( |
14 |
private loginService: LoginService |
|
15 |
private loginService: LoginService, |
|
16 |
private toastService: ToastService |
|
15 | 17 |
) {} |
16 | 18 |
|
17 | 19 |
setUser(user: User): void { |
... | ... | |
28 | 30 |
|
29 | 31 |
getUser$(refresh: boolean = false): Observable<User> { |
30 | 32 |
if (this.userState$.getValue()){ |
31 |
this.loginService.getUserInfo().subscribe(res => this.userState$.next({...this.userState$.getValue(), userInfo: res})); |
|
32 |
} |
|
33 |
this.loginService.getUserInfo$Response().subscribe(res => { |
|
34 |
this.userState$.next({...this.userState$.getValue(), userInfo: res.body}); |
|
35 |
}, err => this.toastService.showError(err.error.message)); |
|
36 |
} |
|
33 | 37 |
return this.userState$.asObservable(); |
34 | 38 |
} |
35 | 39 |
|
Také k dispozici: Unified diff
Re #8850 - Ověření funkčnosti - implementované enpointy
+ new use case add position to unit+ adding sensor type enum from backend endpoint
+ some form validation :)
- removing all endpoints from /senslog1