F: implemented config service in components

This commit is contained in:
X4Lo committed 2025-02-15 23:58:27 +01:00
1 parent cfda451f71
commit 4c5a355dc6
11 files changed
+74 -43

No files matched your search

@@ -5,7 +5,7 @@ import { trigger, transition, style, animate } from '@angular/animations';
import { CollectionService } from '../../../../core/services/collection.service';
import { Router } from '@angular/router';
import { ConfirmModalComponent } from '../../../../shared/components/modals/confirm-modal/confirm-modal.component';
import { environment } from '../../../../../environments/environment.prod';
import { ConfigService } from '../../../../core/services/config.service';
@Component({
selector: 'app-collection-entry-card',
@@ -28,6 +28,7 @@ export class CollectionEntryCardComponent implements OnInit {
constructor(
private collectionService: CollectionService,
private configService: ConfigService,
public dialog: MatDialog,
private router: Router
) {}
@@ -64,7 +65,10 @@ export class CollectionEntryCardComponent implements OnInit {
selectedPosters[0].path
) {
const name = selectedPosters[0].path;
return environment.API_URL + `/media/entries/posters/preview/${name}`;
return (
this.configService.getBackendApiUrl() +
`/media/entries/posters/preview/${name}`
);
}
}
@@ -12,7 +12,7 @@ import { trigger, transition, style, animate } from '@angular/animations';
import { CollectionService } from '../../../../core/services/collection.service';
import { Router } from '@angular/router';
import { ConfirmModalComponent } from '../../../../shared/components/modals/confirm-modal/confirm-modal.component';
import { environment } from '../../../../../environments/environment.prod';
import { ConfigService } from '../../../../core/services/config.service';
@Component({
selector: 'tr [app-collection-entry-line]',
@@ -36,6 +36,7 @@ export class CollectionEntryLineComponent implements OnInit {
constructor(
private collectionService: CollectionService,
private configService: ConfigService,
public dialog: MatDialog,
private router: Router
) {}
@@ -72,7 +73,7 @@ export class CollectionEntryLineComponent implements OnInit {
const name = selectedLogos[0].path.split('.')[0];
const extention = selectedLogos[0].path.split('.')[1];
return (
environment.API_URL +
this.configService.getBackendApiUrl() +
`/media/entries/logos/original/${name}.${extention}`
);
}
@@ -8,7 +8,7 @@ import { MatDialog } from '@angular/material/dialog';
import { ConfirmModalComponent } from '../../../../shared/components/modals/confirm-modal/confirm-modal.component';
import { ScreenshotService } from '../../../../core/services/screenshot.service';
import { CollectionEntryDTO } from '../../../../shared/models/dtos/collection-entry-dto.model';
import { environment } from '../../../../../environments/environment.prod';
import { ConfigService } from '../../../../core/services/config.service';
@Component({
selector: 'app-collection-info-page',
@@ -28,6 +28,7 @@ export class CollectionInfoPageComponent implements OnInit {
private route: ActivatedRoute,
private collectionService: CollectionService,
private screenshotService: ScreenshotService,
private configService: ConfigService,
private datePipe: DatePipe,
public dialog: MatDialog,
private router: Router
@@ -211,9 +212,7 @@ export class CollectionInfoPageComponent implements OnInit {
await this.collection.entries.forEach((entry) => {
const year = new Date(entry.release_date).getFullYear();
if (entry.is_tvseries) {
str += `${entry.title} (${year} - Seasons: ${
entry.seasons.length
})\n`;
str += `${entry.title} (${year} - Seasons: ${entry.seasons.length})\n`;
} else {
str += `${entry.title} (${year})\n`;
}
@@ -318,7 +317,7 @@ export class CollectionInfoPageComponent implements OnInit {
}
return (
environment.API_URL +
this.configService.getBackendApiUrl() +
`/media/collections/posters/preview/${selectedPoster}`
);
}
@@ -356,7 +355,7 @@ export class CollectionInfoPageComponent implements OnInit {
}
return (
environment.API_URL +
this.configService.getBackendApiUrl() +
`/media/collections/backdrops/preview/${selectedBackdrop}`
);
}
@@ -10,7 +10,7 @@ import {
trigger,
} from '@angular/animations';
import { Entry } from '../../../../shared/models/entry.model';
import { environment } from '../../../../../environments/environment.prod';
import { ConfigService } from '../../../../core/services/config.service';
@Component({
selector: 'app-collections-page',
@@ -34,7 +34,10 @@ export class CollectionsPageComponent implements OnInit {
lockActions: boolean = false;
constructor(private collectionsService: CollectionService) {}
constructor(
private collectionsService: CollectionService,
private configService: ConfigService
) {}
ngOnInit() {
this.getCollections();
@@ -136,7 +139,7 @@ export class CollectionsPageComponent implements OnInit {
}
return (
environment.API_URL +
this.configService.getBackendApiUrl() +
`/media/collections/posters/preview/${selectedPoster}`
);
} else if (collection.entries && collection.entries.length != 0) {
@@ -167,7 +170,10 @@ export class CollectionsPageComponent implements OnInit {
if (selectedPosters.length != 0) {
const name = selectedPosters[0].path;
return environment.API_URL + `/media/entries/posters/preview/${name}`;
return (
this.configService.getBackendApiUrl() +
`/media/entries/posters/preview/${name}`
);
}
}