Added new Angular configuration for codespaces

Added CORS control support for codespaces
This commit is contained in:
Tzahi12345
2023-12-03 19:11:21 +00:00
parent 75cbe4d5d0
commit 4bf03bfd1a
7 changed files with 28 additions and 3 deletions

View File

@@ -119,6 +119,7 @@ import {
import { isoLangs } from './dialogs/user-profile-dialog/locales_list';
import { Title } from '@angular/platform-browser';
import { MatDrawerMode } from '@angular/material/sidenav';
import { environment } from '../environments/environment';
@Injectable()
export class PostsService implements CanActivate {
@@ -176,7 +177,7 @@ export class PostsService implements CanActivate {
if (isDevMode()) {
this.debugMode = true;
this.path = 'http://localhost:17442/api/';
this.path = !environment.codespaces ? 'http://localhost:17442/api/' : `${window.location.origin.replace('4200', '17442')}/api/`;
}
this.http_params = `apiKey=${this.auth_token}`

View File

@@ -0,0 +1,9 @@
// The file contents for the current environment will overwrite these during build.
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `.angular-cli.json`.
export const environment = {
production: false,
codespaces: true
};

View File

@@ -1,3 +1,4 @@
export const environment = {
production: true
production: true,
codespaces: false
};

View File

@@ -4,5 +4,6 @@
// The list of which env maps to which file can be found in `.angular-cli.json`.
export const environment = {
production: true
production: false,
codespaces: false
};