feat: started popular titles on main page

This commit is contained in:
2024-07-20 00:59:00 +03:00
parent 2becf42487
commit 6b209077ef
10 changed files with 180 additions and 11 deletions

View File

@@ -6,6 +6,7 @@ import { RulibAuthService } from "./rulib.auth.service";
import { IRulibChapterResult } from "./rulib.chapter.dto";
import { IRulibChaptersResult } from "./rulib.chapters.dto";
import { IRulibDetailResult } from "./rulib.detail.dto";
import { IRuLIBPopular } from "./rulib.popular.dto";
import { IRulibSearchResult } from "./rulib.search.dto";
//TODO: Make abstract classes
@@ -98,4 +99,23 @@ export class LibSocialParserService extends Parser {
catchError((error) => throwError(() => `Now found ${error}`)),
);
}
getPopular(): Observable<IRuLIBPopular[]> {
//TODO: мб сделать ассинхрон
return this.http
.get<{ data: { popular: [] } }>(`${this.url}/api/`, {
headers: {
Authorization: "Bearer " + this.rulibAuthService.getToken(),
"Site-Id": this.site_id,
},
})
.pipe(
map((data) => {
const res = data.data.popular as IRuLIBPopular[];
console.log(res);
return res;
}),
catchError((error) => throwError(() => `Now found ${error}`)),
);
}
}