From 51cb77467dcf09ed2ef394044f640a880bb44416 Mon Sep 17 00:00:00 2001 From: illfixit <66363651+illfixit@users.noreply.github.com> Date: Tue, 15 Oct 2024 18:45:37 +0200 Subject: [PATCH] feat: fakeLogin, clean take(1) --- .../src/app/core/api/fake-backend/impl/fake-users.ts | 6 ++++++ .../catalog-page/catalog-page/catalog-page.component.ts | 1 - .../state/control-center-user-edit-page-state-impl.ts | 1 - .../unauthenticated-page.component.html | 2 +- .../unauthenticated-page.component.ts | 9 +++++++++ .../state/organization-onboard-page-state-impl.ts | 1 - 6 files changed, 16 insertions(+), 4 deletions(-) diff --git a/authority-portal-frontend/src/app/core/api/fake-backend/impl/fake-users.ts b/authority-portal-frontend/src/app/core/api/fake-backend/impl/fake-users.ts index 07022912d..d2ddfb405 100644 --- a/authority-portal-frontend/src/app/core/api/fake-backend/impl/fake-users.ts +++ b/authority-portal-frontend/src/app/core/api/fake-backend/impl/fake-users.ts @@ -310,6 +310,12 @@ export const updateLoggedInUser = (patcher: Patcher) => { currentlyLoggedInUser = patchObj(currentlyLoggedInUser, patcher); }; +export const fakeLogin = () => { + currentlyLoggedInUser = buildUserInfo( + ALL_USERS['00000000-0000-0000-0000-000000000001'], + ); +}; + /** * Fake implementation for "userInfo" endpoint */ diff --git a/authority-portal-frontend/src/app/pages/catalog-page/catalog-page/catalog-page.component.ts b/authority-portal-frontend/src/app/pages/catalog-page/catalog-page/catalog-page.component.ts index 588026ddb..a6a522d89 100644 --- a/authority-portal-frontend/src/app/pages/catalog-page/catalog-page/catalog-page.component.ts +++ b/authority-portal-frontend/src/app/pages/catalog-page/catalog-page/catalog-page.component.ts @@ -115,7 +115,6 @@ export class CatalogPageComponent implements OnInit, OnDestroy { switchMap((isMyDataOffers) => { if (isMyDataOffers) { return this.globalStateUtils.userInfo$.pipe( - take(1), map((it) => it.organizationId), ); } diff --git a/authority-portal-frontend/src/app/pages/control-center-user-edit-page/state/control-center-user-edit-page-state-impl.ts b/authority-portal-frontend/src/app/pages/control-center-user-edit-page/state/control-center-user-edit-page-state-impl.ts index 2e10e0f28..3263ea720 100644 --- a/authority-portal-frontend/src/app/pages/control-center-user-edit-page/state/control-center-user-edit-page-state-impl.ts +++ b/authority-portal-frontend/src/app/pages/control-center-user-edit-page/state/control-center-user-edit-page-state-impl.ts @@ -50,7 +50,6 @@ export class ControlCenterUserEditPageStateImpl { @Action(Reset) onReset(ctx: Ctx, action: Reset): Observable { return this.globalStateUtils.userInfo$.pipe( - take(1), switchMap((userInfo) => this.apiService.getUserDetailDto(userInfo.userId), ), diff --git a/authority-portal-frontend/src/app/pages/empty-pages/unauthenticated-page/unauthenticated-page/unauthenticated-page.component.html b/authority-portal-frontend/src/app/pages/empty-pages/unauthenticated-page/unauthenticated-page/unauthenticated-page.component.html index 67bd0f64c..becc4a4d7 100644 --- a/authority-portal-frontend/src/app/pages/empty-pages/unauthenticated-page/unauthenticated-page/unauthenticated-page.component.html +++ b/authority-portal-frontend/src/app/pages/empty-pages/unauthenticated-page/unauthenticated-page/unauthenticated-page.component.html @@ -14,7 +14,7 @@ + (click)="login()"> Log In ): Observable { return this.globalStateUtils.userInfo$.pipe( - take(1), switchMap((userInfo) => combineLatest([ this.apiService.getOrganizationUser(userInfo.userId),