Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createDispatchMap, select } from '@ngxs/store';
import { Actions, createDispatchMap, ofActionSuccessful, select } from '@ngxs/store';

import { filter } from 'rxjs';
import { filter, take } from 'rxjs';

import { ChangeDetectionStrategy, Component, DestroyRef, effect, inject, OnInit } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
Expand Down Expand Up @@ -29,7 +29,7 @@ export class AppComponent implements OnInit {
private readonly customDialogService = inject(CustomDialogService);
private readonly router = inject(Router);
private readonly environment = inject(ENVIRONMENT);

private readonly actions$ = inject(Actions);
private readonly actions = createDispatchMap({ getCurrentUser: GetCurrentUser, getEmails: GetEmails });

unverifiedEmails = select(UserEmailsSelectors.getUnverifiedEmails);
Expand All @@ -44,7 +44,15 @@ export class AppComponent implements OnInit {

ngOnInit(): void {
this.actions.getCurrentUser();
this.actions.getEmails();

this.actions$
.pipe(
ofActionSuccessful(GetCurrentUser),
take(1)
)
.subscribe(() => {
this.actions.getEmails();
});
Comment on lines +47 to +55
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this?

Copy link
Contributor Author

@mkovalua mkovalua Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is needed to make it possible to initialize user and only afterward do stuff related to emails, if we have user = null we got [] on login though we have emails

2025-10-10 18 16 05

telegram-cloud-photo-size-2-5422848914094160341-y


if (this.environment.googleTagManagerId) {
this.router.events
Expand Down
Loading