| Total Complexity | 6 |
| Complexity/F | 1.5 |
| Lines of Code | 31 |
| Function Count | 4 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| Bugs | 0 | Features | 0 |
| 1 | import path from 'path' |
||
| 2 | import { |
||
| 3 | config, |
||
|
|
|||
| 4 | cmsOperations, |
||
| 5 | abeExtend, |
||
| 6 | Manager |
||
| 7 | } from '../../cli' |
||
| 8 | |||
| 9 | var route = function(req, res, next){ |
||
| 10 | abeExtend.hooks.instance.trigger('beforeRoute', req, res, next) |
||
| 11 | if(typeof res._header !== 'undefined' && res._header !== null) return |
||
| 12 | |||
| 13 | var p = cmsOperations.post.reject( |
||
| 14 | req.body.filePath, |
||
| 15 | req.body.tplPath, |
||
| 16 | req.body.json |
||
| 17 | ); |
||
| 18 | |||
| 19 | p.then((result) => { |
||
| 20 | res.set('Content-Type', 'application/json') |
||
| 21 | res.send(JSON.stringify(result)) |
||
| 22 | }, |
||
| 23 | (result) => { |
||
| 24 | res.set('Content-Type', 'application/json') |
||
| 25 | res.send(JSON.stringify(result)) |
||
| 26 | }).catch(function(e) { |
||
| 27 | console.error('[ERROR] post-reject.js', e) |
||
| 28 | }) |
||
| 29 | } |
||
| 30 | |||
| 31 | export default route |