Fix shelf

This commit is contained in:
aditya.chandel
2025-01-16 00:18:20 -07:00
parent 532246b18b
commit 50dd24e9f2
5 changed files with 5 additions and 9 deletions
@@ -122,7 +122,6 @@ export class BookService {
const url = `/pdf-viewer/book/${book.id}`; const url = `/pdf-viewer/book/${book.id}`;
window.open(url, '_blank'); window.open(url, '_blank');
this.updateLastReadTime(book.id).subscribe({ this.updateLastReadTime(book.id).subscribe({
next: () => console.log('Last read time updated successfully'),
error: err => console.error('Failed to update last read time', err), error: err => console.error('Failed to update last read time', err),
}); });
} else if (book.bookType === "EPUB") { } else if (book.bookType === "EPUB") {
@@ -151,7 +150,6 @@ export class BookService {
} }
getBookData(bookId: number): Observable<Blob> { getBookData(bookId: number): Observable<Blob> {
console.log('Fetching book data...');
return this.http.get<Blob>(`${this.url}/${bookId}/data`, {responseType: 'blob' as 'json'}); return this.http.get<Blob>(`${this.url}/${bookId}/data`, {responseType: 'blob' as 'json'});
} }
@@ -22,6 +22,10 @@ export class ShelfService {
private http = inject(HttpClient); private http = inject(HttpClient);
private bookService = inject(BookService); private bookService = inject(BookService);
constructor() {
this.loadShelves();
}
private loadShelves(): void { private loadShelves(): void {
this.http.get<Shelf[]>(this.url).pipe( this.http.get<Shelf[]>(this.url).pipe(
catchError(error => { catchError(error => {
@@ -72,9 +72,6 @@ export class SettingsComponent implements OnInit {
populateSettings(settings: AppSettings): void { populateSettings(settings: AppSettings): void {
if (settings.pdf) { if (settings.pdf) {
const pdfSettings = settings.pdf; const pdfSettings = settings.pdf;
console.log(pdfSettings)
this.selectedSpread = this.spreads.find(s => s.key === pdfSettings.spread)?.key; this.selectedSpread = this.spreads.find(s => s.key === pdfSettings.spread)?.key;
this.selectedZoom = this.zooms.find(z => z.key === pdfSettings.zoom)?.key; this.selectedZoom = this.zooms.find(z => z.key === pdfSettings.zoom)?.key;
this.showSidebar = pdfSettings.sidebar; this.showSidebar = pdfSettings.sidebar;
@@ -83,8 +80,6 @@ export class SettingsComponent implements OnInit {
if (settings.epub) { if (settings.epub) {
const epubSettings = settings.epub; const epubSettings = settings.epub;
this.selectedTheme = this.themes.find(t => t.key === epubSettings.theme)?.key; this.selectedTheme = this.themes.find(t => t.key === epubSettings.theme)?.key;
console.log(epubSettings.fontSize)
this.fontSize = parseInt(epubSettings.fontSize, 10); this.fontSize = parseInt(epubSettings.fontSize, 10);
this.selectedFont = this.fonts.find(f => f.key === epubSettings.font)?.key; this.selectedFont = this.fonts.find(f => f.key === epubSettings.font)?.key;
} }
@@ -36,7 +36,7 @@ export class AppSettingsService {
this.http.put(this.apiUrl, null, { params }).subscribe({ this.http.put(this.apiUrl, null, { params }).subscribe({
next: () => { next: () => {
console.log('Setting saved successfully');
}, },
error: (error) => { error: (error) => {
console.error('Error saving setting:', error); console.error('Error saving setting:', error);
@@ -71,7 +71,6 @@ export class FileUploadComponent {
this.isUploading = true; this.isUploading = true;
this.fileUploadService.uploadFile(file, libraryId, path).subscribe({ this.fileUploadService.uploadFile(file, libraryId, path).subscribe({
next: () => { next: () => {
console.log('File uploaded successfully');
this.toastService.showSuccess("File uploaded", file.name); this.toastService.showSuccess("File uploaded", file.name);
this.isUploading = false; this.isUploading = false;
this.dynamicDialogRef.close(); this.dynamicDialogRef.close();