diff --git a/src/main/angular/src/app/api/User/user.service.ts b/src/main/angular/src/app/api/User/user.service.ts index 26cc05f..89917ae 100644 --- a/src/main/angular/src/app/api/User/user.service.ts +++ b/src/main/angular/src/app/api/User/user.service.ts @@ -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): void { @@ -38,7 +42,10 @@ export class UserService { } changeName(name: string, next?: Next) { - 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) {