Browse Source

application builder added

pull/23416/head
erdemcaygor 1 year ago
parent
commit
e40a782db4
  1. 3
      npm/ng-packs/.prettierignore
  2. 2
      npm/ng-packs/apps/dev-app/project.json
  3. 3
      npm/ng-packs/packages/core/src/lib/utils/initial-utils.ts
  4. 39
      npm/ng-packs/packages/oauth/src/lib/services/server-token-storage.service.ts

3
npm/ng-packs/.prettierignore

@ -9,4 +9,5 @@
/tools
/source-code-requirements
/.nx/cache
/.nx/workspace-data
/.nx/workspace-data
.angular

2
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

3
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);
}

39
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<string, string> = 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<string, string>();
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 {}
}

Loading…
Cancel
Save