Работа над проектом
This commit is contained in:
@@ -72,6 +72,8 @@ class WebSocketController {
|
||||
await this.getBookList(req, ws); break;
|
||||
case 'get-genre-tree':
|
||||
await this.getGenreTree(req, ws); break;
|
||||
case 'get-book-link':
|
||||
await this.getBookLink(req, ws); break;
|
||||
|
||||
default:
|
||||
throw new Error(`Action not found: ${req.action}`);
|
||||
@@ -141,6 +143,15 @@ class WebSocketController {
|
||||
|
||||
this.send(result, req, ws);
|
||||
}
|
||||
|
||||
async getBookLink(req, ws) {
|
||||
if (!utils.hasProp(req, 'bookPath'))
|
||||
throw new Error(`bookPath is empty`);
|
||||
|
||||
const result = await this.webWorker.getBookLink(req.bookPath);
|
||||
|
||||
this.send(result, req, ws);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = WebSocketController;
|
||||
|
||||
Reference in New Issue
Block a user