diff --git a/src/Squidex/app/shared/services/apps-store.service.ts b/src/Squidex/app/shared/services/apps-store.service.ts index 934ef21df..d5c5f84a9 100644 --- a/src/Squidex/app/shared/services/apps-store.service.ts +++ b/src/Squidex/app/shared/services/apps-store.service.ts @@ -18,7 +18,7 @@ import { @Injectable() export class AppsStoreService { - private readonly apps$ = new ReplaySubject(); + private readonly apps$ = new ReplaySubject(1); private readonly app$ = new BehaviorSubject(null); public get apps(): Observable { diff --git a/src/Squidex/app/shared/services/auth.service.ts b/src/Squidex/app/shared/services/auth.service.ts index c22933116..4caef7624 100644 --- a/src/Squidex/app/shared/services/auth.service.ts +++ b/src/Squidex/app/shared/services/auth.service.ts @@ -54,7 +54,7 @@ export class Profile { @Injectable() export class AuthService { private readonly userManager: UserManager; - private readonly user$ = new ReplaySubject(); + private readonly user$ = new ReplaySubject(1); private currentUser: Profile = null; public get user(): Profile | null { @@ -96,7 +96,7 @@ export class AuthService { this.currentUser = user; }); - this.userManager.signinSilent(); + this.checkState(this.userManager.signinSilent()); } public logoutRedirect(): Observable { @@ -118,4 +118,12 @@ export class AuthService { public loginRedirectComplete(): Observable { return Observable.fromPromise(this.userManager.signinRedirectCallback()); } + + private checkState(promise: Promise) { + promise.catch((err) => { + this.user$.next(null); + + return false; + }); + } } \ No newline at end of file