make grid view cells clickable (#1485)
This commit is contained in:
@@ -3,6 +3,8 @@ import {API_CONFIG} from '../../core/config/api-config';
|
||||
import {AuthService} from './auth.service';
|
||||
import {BookService} from '../../features/book/service/book.service';
|
||||
import {CoverGeneratorComponent} from '../components/cover-generator/cover-generator.component';
|
||||
import { Router } from '@angular/router';
|
||||
import { Book } from '../../features/book/model/book.model';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -12,6 +14,7 @@ export class UrlHelperService {
|
||||
private readonly mediaBaseUrl = `${this.baseUrl}/api/v1/media`;
|
||||
private authService = inject(AuthService);
|
||||
private bookService = inject(BookService);
|
||||
private router = inject(Router);
|
||||
|
||||
private getToken(): string | null {
|
||||
return this.authService.getOidcAccessToken() || this.authService.getInternalAccessToken();
|
||||
@@ -75,4 +78,26 @@ export class UrlHelperService {
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
getBookUrl(book: Book) {
|
||||
return this.router.createUrlTree(['/book', book.id], {
|
||||
queryParams: {tab: 'view'}
|
||||
});
|
||||
}
|
||||
|
||||
filterBooksBy(filterKey: string, filterValue: string){
|
||||
if (filterKey === 'series') {
|
||||
return this.router.createUrlTree(['/series', encodeURIComponent(filterValue)])
|
||||
}
|
||||
|
||||
return this.router.createUrlTree(['/all-books'], {
|
||||
queryParams: {
|
||||
view: 'grid',
|
||||
sort: 'title',
|
||||
direction: 'asc',
|
||||
sidebar: true,
|
||||
filter: `${filterKey}:${encodeURIComponent(filterValue)}`
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user