diff --git a/npm/ng-packs/.prettierignore b/npm/ng-packs/.prettierignore index ab9e6cdaa7..feffcae59f 100644 --- a/npm/ng-packs/.prettierignore +++ b/npm/ng-packs/.prettierignore @@ -9,4 +9,5 @@ /tools /source-code-requirements /.nx/cache -/.nx/workspace-data \ No newline at end of file +/.nx/workspace-data +.angular diff --git a/npm/ng-packs/apps/dev-app/project.json b/npm/ng-packs/apps/dev-app/project.json index c77c3c3cee..37f0502dde 100644 --- a/npm/ng-packs/apps/dev-app/project.json +++ b/npm/ng-packs/apps/dev-app/project.json @@ -187,7 +187,7 @@ "continuous": true, "executor": "@nx/web:file-server", "options": { - "buildTarget": "my-app:build", + "buildTarget": "dev-app:build", "port": 4200, "staticFilePath": "dist/apps/dev-app/browser", "spa": true diff --git a/npm/ng-packs/packages/core/src/lib/utils/initial-utils.ts b/npm/ng-packs/packages/core/src/lib/utils/initial-utils.ts index 0c65073ef6..ece0404dcb 100644 --- a/npm/ng-packs/packages/core/src/lib/utils/initial-utils.ts +++ b/npm/ng-packs/packages/core/src/lib/utils/initial-utils.ts @@ -49,7 +49,8 @@ export async function getInitialData() { return throwError(() => error); }), ); - await lastValueFrom(result$); + // TODO: Not working with SSR + // await lastValueFrom(result$); await localeInitializer(injector); } diff --git a/npm/ng-packs/packages/oauth/src/lib/services/server-token-storage.service.ts b/npm/ng-packs/packages/oauth/src/lib/services/server-token-storage.service.ts index 335cb6ced2..0926b749d8 100644 --- a/npm/ng-packs/packages/oauth/src/lib/services/server-token-storage.service.ts +++ b/npm/ng-packs/packages/oauth/src/lib/services/server-token-storage.service.ts @@ -1,33 +1,32 @@ -import { Inject, Injectable } from '@angular/core'; +import { Inject, Injectable, Optional } from '@angular/core'; import { OAuthStorage } from 'angular-oauth2-oidc'; +import { REQUEST } from '@angular/core'; -@Injectable({ - providedIn: null, -}) +@Injectable({ providedIn: null }) export class ServerTokenStorageService implements OAuthStorage { - private cookies: Map = new Map(); - constructor(@Inject('cookies') c: string | undefined) { - if (c) { - const cookieItems = c.split(';'); - for (const item of cookieItems) { - const index = item.indexOf('='); - if (index > -1) { - const key = item.slice(0, index).trim(); - const value = item.slice(index + 1).trim(); - this.cookies.set(key, value); - } + private cookies = new Map(); + + constructor(@Optional() @Inject(REQUEST) private req: Request | null) { + const cookieHeader = this.req?.headers.get('cookie') ?? ''; + for (const part of cookieHeader.split(';')) { + const i = part.indexOf('='); + if (i > -1) { + const k = part.slice(0, i).trim(); + const v = decodeURIComponent(part.slice(i + 1).trim()); + this.cookies.set(k, v); } } } getItem(key: string): string { - if (this.cookies) { - return this.cookies.get(key); + const fromCookie = this.cookies.get(key); + if (fromCookie) { + return fromCookie; } + return ''; } - removeItem(key: string): void {} - - setItem(key: string, data: string): void {} + setItem(_k: string, _v: string): void {} + removeItem(_k: string): void {} }