From 703f9dc2c1bc325cb1295588e53766476d571898 Mon Sep 17 00:00:00 2001 From: Silke Date: Sat, 26 Oct 2024 09:19:22 +0200 Subject: [PATCH] fix: double header display in checkout --- src/app/core/guards/no-server-side-rendering.guard.ts | 6 +++--- src/app/pages/loading/loading-page.module.ts | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/app/core/guards/no-server-side-rendering.guard.ts b/src/app/core/guards/no-server-side-rendering.guard.ts index 7e7e5a437a..bbe67a2b48 100644 --- a/src/app/core/guards/no-server-side-rendering.guard.ts +++ b/src/app/core/guards/no-server-side-rendering.guard.ts @@ -1,15 +1,15 @@ import { inject } from '@angular/core'; -import { Router } from '@angular/router'; +import { ActivatedRouteSnapshot, Router } from '@angular/router'; /** * guards a route against server side rendering (e.g. if the logic requires information only available in browser rendering) */ -export function noServerSideRenderingGuard() { +export function noServerSideRenderingGuard(route: ActivatedRouteSnapshot) { const router = inject(Router); // prevent any handling in the server side rendering (SSR) and instead show loading if (SSR) { - return router.parseUrl('/loading'); + return router.parseUrl(route.data.headerType === 'checkout' ? '/loading/checkout' : '/loading'); } // if not in SSR just return true and continue diff --git a/src/app/pages/loading/loading-page.module.ts b/src/app/pages/loading/loading-page.module.ts index aebcd09c01..390023682c 100644 --- a/src/app/pages/loading/loading-page.module.ts +++ b/src/app/pages/loading/loading-page.module.ts @@ -14,6 +14,13 @@ const loadingPageRoutes: Routes = [ headerType: 'simple', }, }, + { + path: 'checkout', + component: LoadingPageComponent, + data: { + headerType: 'checkout', + }, + }, ]; @NgModule({