JOE
2018-10-23 62e43012572ea0c47eb6bb928e86e45040c4bb7b
modify url path
1 files modified
7 ■■■■■ changed files
routes/roles.js 7 ●●●●● patch | view | raw | blame | history
routes/roles.js
....@@ -32,7 +32,7 @@
3232 const data = Object.assign(req.body) || {};
3333 data.welcome_page_modile = util.generatePath(data.welcome_page_modile);
3434 Roles.create(data).then(role => {
35
- res.redirect('/roles/');
35
+ res.redirect('../roles/');
3636 }).catch(err => {
3737 Modules.find({}).then(function (modules) {
3838 const param = util.initParam();
....@@ -61,10 +61,9 @@
6161 });
6262 });
6363
64
-router.post('/', function(req, res, next) {
64
+router.post('/:role_id', function(req, res, next) {
6565 const data = Object.assign(req.body) || {};
66
- data.welcome_page_modile = util.generatePath(data.welcome_page_modile);
67
- Roles.updateMany({_id: data.id}, { $set: data}, function(err, response) {
66
+ Roles.updateMany({_id: req.params.role_id}, { $set: data}, function(err, response) {
6867 const param = util.initParam();
6968 if(err) {
7069 param.error = util.errorJson(err).result_msg;