123456789101112131415161718192021222324252627282930313233343536 |
- const BasePage = require('./BasePage');
- const AuthorPage = require('./AuthorPage');
- const SeriesPage = require('./SeriesPage');
- class RootPage extends BasePage {
- constructor(config) {
- super(config);
- this.id = 'root';
- this.title = '';
- this.authorPage = new AuthorPage(config);
- this.seriesPage = new SeriesPage(config);
- }
- async body(req) {
- const result = {};
- if (!this.title) {
- const dbConfig = await this.webWorker.dbConfig();
- const collection = dbConfig.inpxInfo.collection.split('\n');
- this.title = collection[0].trim();
- if (!this.title)
- this.title = 'Неизвестная коллекция';
- }
- result.entry = [
- this.authorPage.myEntry(),
- this.seriesPage.myEntry(),
- ];
- return this.makeBody(result, req);
- }
- }
- module.exports = RootPage;
|