feat: auth page

This commit is contained in:
2024-07-10 16:35:14 +03:00
parent 6833105604
commit 112e76ab45
10 changed files with 199 additions and 46 deletions

View File

@@ -16,6 +16,7 @@ import { SearchService } from "../../services/search.service";
export class DetailComponent implements AfterViewInit, OnDestroy {
detail_item: Data | null = null;
chapters: IRulibChaptersResult = { data: [] };
needAuth: boolean = false;
private destroy$ = new Subject<void>();
constructor(
private route: ActivatedRoute,
@@ -27,15 +28,27 @@ export class DetailComponent implements AfterViewInit, OnDestroy {
this.searchService
.getDetails(url)
.pipe(takeUntil(this.destroy$))
.subscribe((data) => {
this.detail_item = data.data;
.subscribe({
next: (data) => {
this.detail_item = data.data;
},
error: (error) => {
console.log(error);
},
});
this.searchService
.getChapters(url)
.pipe(takeUntil(this.destroy$))
.subscribe((data) => {
this.chapters = data;
console.log(data);
.subscribe({
next: (data) => {
this.chapters = data;
if (data.data.length === 0) {
this.needAuth = true;
}
},
error: (error) => {
console.log(error);
},
});
}