RootPage.js 797 B

123456789101112131415161718192021222324252627282930313233
  1. const BasePage = require('./BasePage');
  2. const AuthorPage = require('./AuthorPage');
  3. class RootPage extends BasePage {
  4. constructor(config) {
  5. super(config);
  6. this.id = 'root';
  7. this.title = '';
  8. this.authorPage = new AuthorPage(config);
  9. }
  10. async body() {
  11. const result = {};
  12. if (!this.title) {
  13. const dbConfig = await this.webWorker.dbConfig();
  14. const collection = dbConfig.inpxInfo.collection.split('\n');
  15. this.title = collection[0].trim();
  16. if (!this.title)
  17. this.title = 'Неизвестная коллекция';
  18. }
  19. result.entry = [
  20. this.authorPage.myEntry(),
  21. ];
  22. return this.makeBody(result);
  23. }
  24. }
  25. module.exports = RootPage;