WIP: Docker
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {HttpClient, HttpHeaders} from '@angular/common/http';
|
||||
import {API_CONFIG} from '../../config/api-config';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class FileService {
|
||||
private readonly url = 'http://localhost:8080/v1/book';
|
||||
private readonly url = `${API_CONFIG.BASE_URL}/v1/book`;
|
||||
private readonly http = inject(HttpClient);
|
||||
|
||||
downloadFile(bookId: number): void {
|
||||
|
||||
@@ -6,12 +6,13 @@ import {Library} from '../model/library.model';
|
||||
import {BookService} from './book.service';
|
||||
import {SortOption} from '../model/sort.model';
|
||||
import {LibraryState} from '../model/state/library-state.model';
|
||||
import {API_CONFIG} from '../../config/api-config';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class LibraryService {
|
||||
private readonly url = 'http://localhost:8080/v1/library';
|
||||
private readonly url = `${API_CONFIG.BASE_URL}/v1/library`;
|
||||
|
||||
private libraryStateSubject = new BehaviorSubject<LibraryState>({
|
||||
libraries: null,
|
||||
|
||||
@@ -6,12 +6,13 @@ import { Shelf } from '../model/shelf.model';
|
||||
import { SortOption } from '../model/sort.model';
|
||||
import { BookService } from './book.service';
|
||||
import { ShelfState } from '../model/state/shelf-state.model';
|
||||
import {API_CONFIG} from '../../config/api-config';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ShelfService {
|
||||
private readonly url = 'http://localhost:8080/v1/shelf';
|
||||
private readonly url = `${API_CONFIG.BASE_URL}/v1/shelf`;
|
||||
private shelfStateSubject = new BehaviorSubject<ShelfState>({
|
||||
shelves: null,
|
||||
loaded: false,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export const API_CONFIG = {
|
||||
BASE_URL: 'http://localhost:8080'
|
||||
BASE_URL: `http://localhost:${window.location.port || 8080}`,
|
||||
BROKER_URL: `ws://localhost:${window.location.port || 8080}/ws`
|
||||
};
|
||||
|
||||
@@ -2,12 +2,13 @@ import {Injectable} from '@angular/core';
|
||||
import {HttpClient, HttpParams} from '@angular/common/http';
|
||||
import {BehaviorSubject} from 'rxjs';
|
||||
import {AppSettings} from '../model/app-settings.model';
|
||||
import {API_CONFIG} from '../../config/api-config';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AppSettingsService {
|
||||
private apiUrl = 'http://localhost:8080/api/settings';
|
||||
private readonly apiUrl = `${API_CONFIG.BASE_URL}/api/settings`;
|
||||
|
||||
private appSettingsSubject = new BehaviorSubject<AppSettings | null>(null);
|
||||
appSettings$ = this.appSettingsSubject.asObservable();
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import {inject, Injectable} from '@angular/core';
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {Observable} from 'rxjs';
|
||||
import {API_CONFIG} from '../../config/api-config';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class EpubService {
|
||||
private baseUrl = 'http://localhost:8080/api/epub';
|
||||
private baseUrl = `${API_CONFIG.BASE_URL}/api/epub`;
|
||||
|
||||
private http = inject(HttpClient);
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { RxStompConfig } from '@stomp/rx-stomp';
|
||||
import {RxStompConfig} from '@stomp/rx-stomp';
|
||||
import {API_CONFIG} from '../../config/api-config';
|
||||
|
||||
export const rxStompConfig: RxStompConfig = {
|
||||
// Which server?
|
||||
brokerURL: 'ws://localhost:8080/ws',
|
||||
brokerURL: API_CONFIG.BROKER_URL,
|
||||
|
||||
// Headers
|
||||
// Typical keys: login, passcode, host
|
||||
|
||||
@@ -10,6 +10,7 @@ import {Library, LibraryPath} from '../../../book/model/library.model';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||
import {Select} from 'primeng/select';
|
||||
import {API_CONFIG} from '../../../config/api-config';
|
||||
|
||||
@Component({
|
||||
selector: 'app-book-uploader',
|
||||
@@ -26,7 +27,7 @@ import {Select} from 'primeng/select';
|
||||
})
|
||||
export class BookUploaderComponent {
|
||||
|
||||
private uploadUrl = 'http://localhost:8080/api/v1/files/upload';
|
||||
private uploadUrl = `${API_CONFIG.BASE_URL}/api/v1/files/upload`;
|
||||
|
||||
private libraryService = inject(LibraryService);
|
||||
private messageService = inject(MessageService);
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import {inject, Injectable} from '@angular/core';
|
||||
import {Observable} from 'rxjs';
|
||||
import {HttpClient, HttpParams} from '@angular/common/http';
|
||||
import {API_CONFIG} from '../../../config/api-config';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class UtilityService {
|
||||
|
||||
private pathUrl = 'http://localhost:8080/v1/path';
|
||||
private pathUrl = `${API_CONFIG.BASE_URL}/v1/path`;
|
||||
|
||||
private http = inject(HttpClient);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user