feat: auth page
This commit is contained in:
@@ -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);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user