refreshing current user on WS connect
This commit is contained in:
parent
7ff944dec4
commit
aa126f7f45
@ -7,6 +7,7 @@ import {UserPublic} from "./UserPublic";
|
||||
import {Router} from "@angular/router";
|
||||
import {BehaviorSubject, Subscription} from "rxjs";
|
||||
import {AbstractSession} from "../Session/AbstractSession";
|
||||
import {StompService} from "@stomp/ng2-stompjs";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@ -22,8 +23,11 @@ export class UserService {
|
||||
constructor(
|
||||
protected readonly router: Router,
|
||||
protected readonly api: ApiService,
|
||||
protected readonly stompService: StompService,
|
||||
) {
|
||||
this.refresh();
|
||||
this.stompService.connected$.subscribe(() => {
|
||||
this.refresh();
|
||||
});
|
||||
}
|
||||
|
||||
getCommonByUuid(uuid: string, next: Next<UserCommon>): void {
|
||||
@ -38,7 +42,10 @@ export class UserService {
|
||||
}
|
||||
|
||||
changeName(name: string, next?: Next<UserPrivate>) {
|
||||
this.api.postSingle(['User', 'changeName'], name, UserPrivate.fromJson, next);
|
||||
this.api.postSingle(['User', 'changeName'], name, UserPrivate.fromJson, user => {
|
||||
this.refresh();
|
||||
next && next(user);
|
||||
});
|
||||
}
|
||||
|
||||
goto(user: UserPublic) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user