feat: started details page
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import { AfterViewInit, Component } from "@angular/core";
|
||||
import { ActivatedRoute, Router, RouterModule } from "@angular/router";
|
||||
import { Component } from "@angular/core";
|
||||
import { RouterModule } from "@angular/router";
|
||||
import { AppService } from "./app.service";
|
||||
import { HeaderComponent } from "./components/header/header.component";
|
||||
import { Datum } from "./services/parsers/rulib/rulib.dto";
|
||||
import { SearchService } from "./services/search.service";
|
||||
import { Datum } from "./services/parsers/rulib/rulib.search.dto";
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
@@ -13,15 +12,10 @@ import { SearchService } from "./services/search.service";
|
||||
styleUrl: "./app.component.less",
|
||||
providers: [AppService],
|
||||
})
|
||||
export class AppComponent implements AfterViewInit {
|
||||
export class AppComponent {
|
||||
title = "NwaifuAnime";
|
||||
items: Datum[] = [];
|
||||
constructor(
|
||||
private sw: AppService,
|
||||
private searchService: SearchService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
) {}
|
||||
constructor(private sw: AppService) {}
|
||||
|
||||
get hasUpdate() {
|
||||
return this.sw.isUpdateAvailable;
|
||||
@@ -34,21 +28,4 @@ export class AppComponent implements AfterViewInit {
|
||||
get serviceWorkerEnabled() {
|
||||
return this.sw.serviceWorkerEnabled;
|
||||
}
|
||||
|
||||
onSearch(text: string) {
|
||||
const currentParams = this.route.snapshot.queryParams;
|
||||
const newParams = { ...currentParams, search: text };
|
||||
this.router.navigate([], { queryParams: newParams });
|
||||
this.searchService.search(text);
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
this.route.queryParams.subscribe((params) => {
|
||||
console.log(params);
|
||||
const searchParam: string | undefined = params["search"];
|
||||
if (searchParam) {
|
||||
this.searchService.search(searchParam);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user