UNPKG

1.39 kBJavaScriptView Raw
1/**
2 * @copyright Copyright (c) 2019 Maxim Khorin <maksimovichu@gmail.com>
3 */
4'use strict';
5
6const Base = require('./Base');
7
8module.exports = class Action extends Base {
9
10 execute () {
11 throw new Error('Need to override');
12 }
13
14 getRelativeModuleName () {
15 return `${this.controller.getBaseName()}/${this.name}`;
16 }
17
18 getUniqueName () {
19 return this.module.getRoute(this.getRelativeModuleName());
20 }
21
22 // REQUEST
23
24 isAjax () {
25 return this.controller.isAjax();
26 }
27
28 isGet () {
29 return this.controller.isGet();
30 }
31
32 isPost () {
33 return this.controller.isPost();
34 }
35
36 getQueryParam () {
37 return this.controller.getQueryParam(...arguments);
38 }
39
40 getQueryParams () {
41 return this.controller.getQueryParams();
42 }
43
44 getPostParam () {
45 return this.controller.getPostParam(...arguments);
46 }
47
48 getPostParams () {
49 return this.controller.getPostParams();
50 }
51
52 // RENDER
53
54 render () {
55 return this.controller.render(...arguments);
56 }
57
58 // SEND
59
60 send () {
61 return this.controller.send(...arguments);
62 }
63
64 sendJson () {
65 return this.controller.sendJson(...arguments);
66 }
67
68 sendText () {
69 return this.controller.sendText(...arguments);
70 }
71};
\No newline at end of file