Configure proxy for API requests and remove hardcoded apiUrl from environment files.

This commit is contained in:
akastijn 2025-09-24 21:47:55 +02:00
parent 4878ad9f0d
commit 2a0f38aa28
3 changed files with 5 additions and 12 deletions

View File

@ -1,11 +1,10 @@
import {Component} from '@angular/core';
import {ScrollService} from '@services/scroll.service';
import {BASE_PATH, Player, TeamService} from '@api';
import { CommonModule, NgOptimizedImage } from '@angular/common';
import {Player, TeamService} from '@api';
import {CommonModule, NgOptimizedImage} from '@angular/common';
import {HeaderComponent} from '@header/header.component';
import {CookieService} from 'ngx-cookie-service';
import {map, Observable, shareReplay} from 'rxjs';
import {environment} from '@environment';
@Component({
selector: 'app-team',
@ -17,7 +16,6 @@ import {environment} from '@environment';
],
providers: [
CookieService,
{provide: BASE_PATH, useValue: environment.apiUrl}
],
templateUrl: './team.component.html',

View File

@ -1,11 +1,10 @@
import {Component, EventEmitter, Input, OnChanges, OnInit, Output} from '@angular/core';
import {BASE_PATH, HistoryService, PunishmentHistory} from '@api';
import {HistoryService, PunishmentHistory} from '@api';
import {catchError, map, Observable, shareReplay} from 'rxjs';
import { NgOptimizedImage } from '@angular/common';
import {NgOptimizedImage} from '@angular/common';
import {CookieService} from 'ngx-cookie-service';
import {RemoveTrailingPeriodPipe} from '@pipes/RemoveTrailingPeriodPipe';
import {HttpErrorResponse} from '@angular/common/http';
import {environment} from '@environment';
import {HistoryFormatService} from '../history-format.service';
import {SearchParams} from '../search-terms';
import {Router} from '@angular/router';
@ -15,12 +14,11 @@ import {Router} from '@angular/router';
imports: [
NgOptimizedImage,
RemoveTrailingPeriodPipe
],
],
templateUrl: './history.component.html',
styleUrl: './history.component.scss',
providers: [
CookieService,
{provide: BASE_PATH, useValue: environment.apiUrl}
],
})
export class HistoryComponent implements OnInit, OnChanges {

View File

@ -3,15 +3,12 @@ import {AppComponent} from './app/app.component';
import {provideRouter} from '@angular/router';
import {routes} from './app/app.routes';
import {provideHttpClient, withInterceptors} from '@angular/common/http';
import {BASE_PATH} from '@api';
import {environment} from '@environment';
import {authInterceptor} from '@services/AuthInterceptor';
bootstrapApplication(AppComponent, {
providers: [
provideRouter(routes),
provideHttpClient(),
{provide: BASE_PATH, useValue: environment.apiUrl},
provideHttpClient(
withInterceptors([authInterceptor])
),