diff --git a/apps/NwaifuAnime/src/app/app.component.ts b/apps/NwaifuAnime/src/app/app.component.ts
index be17e4e..292517b 100644
--- a/apps/NwaifuAnime/src/app/app.component.ts
+++ b/apps/NwaifuAnime/src/app/app.component.ts
@@ -1,8 +1,7 @@
-import { Component } from "@angular/core";
-import { RouterModule } from "@angular/router";
+import { AfterViewInit, Component } from "@angular/core";
+import { ActivatedRoute, Router, RouterModule } from "@angular/router";
import { AppService } from "./app.service";
import { HeaderComponent } from "./components/header/header.component";
-import { LibSocialParserService } from "./services/parsers/rulib/lib.social.parser.service";
import { Datum } from "./services/parsers/rulib/rulib.dto";
import { SearchService } from "./services/search.service";
@@ -14,13 +13,14 @@ import { SearchService } from "./services/search.service";
styleUrl: "./app.component.less",
providers: [AppService],
})
-export class AppComponent {
+export class AppComponent implements AfterViewInit {
title = "NwaifuAnime";
items: Datum[] = [];
constructor(
private sw: AppService,
- private parser: LibSocialParserService,
private searchService: SearchService,
+ private route: ActivatedRoute,
+ private router: Router,
) {}
get hasUpdate() {
@@ -36,6 +36,19 @@ export class AppComponent {
}
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);
+ }
+ });
+ }
}
diff --git a/apps/NwaifuAnime/src/app/components/home/home.component.html b/apps/NwaifuAnime/src/app/components/home/home.component.html
index 1706b64..0edf639 100644
--- a/apps/NwaifuAnime/src/app/components/home/home.component.html
+++ b/apps/NwaifuAnime/src/app/components/home/home.component.html
@@ -1,7 +1,11 @@
It's home component
-@for (item of items; track $index) {
-
-
{{ item.rus_name }}
-
![]()
-
-}
+
+ @for (item of items; track $index) {
+
+ }
+
diff --git a/apps/NwaifuAnime/src/app/components/home/home.component.ts b/apps/NwaifuAnime/src/app/components/home/home.component.ts
index 5597042..79a8f45 100644
--- a/apps/NwaifuAnime/src/app/components/home/home.component.ts
+++ b/apps/NwaifuAnime/src/app/components/home/home.component.ts
@@ -23,6 +23,12 @@ export class HomeComponent implements OnInit, OnDestroy {
});
}
+ getDetails(slug_url: string) {
+ this.searchService.getDetails(slug_url).subscribe((data) => {
+ console.log(data);
+ });
+ }
+
ngOnDestroy(): void {
this.subscription.unsubscribe();
}
diff --git a/apps/NwaifuAnime/src/app/services/parsers/rulib/lib.social.parser.service.ts b/apps/NwaifuAnime/src/app/services/parsers/rulib/lib.social.parser.service.ts
index 8fbc863..a4975f4 100644
--- a/apps/NwaifuAnime/src/app/services/parsers/rulib/lib.social.parser.service.ts
+++ b/apps/NwaifuAnime/src/app/services/parsers/rulib/lib.social.parser.service.ts
@@ -24,4 +24,19 @@ export class LibSocialParserService {
}),
);
}
+
+ getDetails(slug_url: string) {
+ return this.http
+ .get(
+ `${this.url}/api/manga/${slug_url}?fields[]=summary&fields[]=genres&fields[]=tags&fields[]=authors`,
+ )
+ .pipe(
+ map((data: object) => {
+ return data;
+ }),
+ catchError((error) => {
+ return throwError(() => `Now found ${error}`);
+ }),
+ );
+ }
}
diff --git a/apps/NwaifuAnime/src/app/services/search.service.ts b/apps/NwaifuAnime/src/app/services/search.service.ts
index cf38e39..822700d 100644
--- a/apps/NwaifuAnime/src/app/services/search.service.ts
+++ b/apps/NwaifuAnime/src/app/services/search.service.ts
@@ -1,5 +1,5 @@
import { Injectable } from "@angular/core";
-import { BehaviorSubject } from "rxjs";
+import { BehaviorSubject, Observable, map } from "rxjs";
import { LibSocialParserService } from "./parsers/rulib/lib.social.parser.service";
import { Datum } from "./parsers/rulib/rulib.dto";
@@ -14,4 +14,12 @@ export class SearchService {
this.itemsTerm.next(data.data);
});
}
+
+ getDetails(slug_url: string): Observable