diff options
| author | Pitu <[email protected]> | 2017-01-19 02:37:35 -0300 |
|---|---|---|
| committer | Pitu <[email protected]> | 2017-01-19 02:37:35 -0300 |
| commit | 83aaef0f824e8776ddf4c60a44e6d56c21a0efcc (patch) | |
| tree | b9474b361cc328d43fe5bfd4949702c6566819f2 /controllers/albumsController.js | |
| parent | Small fixes (diff) | |
| download | host.fuwn.me-83aaef0f824e8776ddf4c60a44e6d56c21a0efcc.tar.xz host.fuwn.me-83aaef0f824e8776ddf4c60a44e6d56c21a0efcc.zip | |
Changed request system and post data
Changed from XMLHttpRequest to Axiios and made every POST call to look for params or json and not pass the values as headers. Token is still a header though
Diffstat (limited to 'controllers/albumsController.js')
| -rw-r--r-- | controllers/albumsController.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/controllers/albumsController.js b/controllers/albumsController.js index 9c666be..55885f5 100644 --- a/controllers/albumsController.js +++ b/controllers/albumsController.js @@ -6,16 +6,16 @@ let albumsController = {} albumsController.list = function(req, res, next){ if(req.headers.auth !== config.adminToken) - return res.status(401).send('not-authorized') + return res.status(401).json({ success: false, description: 'not-authorized'}) let fields = ['id', 'name'] - if(req.headers.extended !== undefined) + if(req.params.sidebar === undefined) fields.push('timestamp') db.table('albums').select(fields).where('enabled', 1).then((albums) => { - if(req.headers.extended === undefined) + if(req.params.sidebar !== undefined) return res.json({ success: true, albums }) let ids = [] @@ -42,9 +42,9 @@ albumsController.list = function(req, res, next){ albumsController.create = function(req, res, next){ if(req.headers.auth !== config.adminToken) - return res.status(401).send('not-authorized') + return res.status(401).json({ success: false, description: 'not-authorized'}) - let name = req.headers.name + let name = req.body.name if(name === undefined || name === '') return res.json({ success: false, description: 'No album name specified' }) |