@@ -35,7 +35,6 @@ const Scrapper = require('../../schemas/scrapper');
3535 */
3636router . get ( '/' , function ( req , res , next ) {
3737 let chck = req . session ;
38-
3938 if ( chck && chck . userId ) {
4039 User . findById ( chck . userId ) . exec ( function ( error , user ) {
4140 if ( error || ! user ) {
@@ -78,7 +77,7 @@ router.post('/newscrapper', function (req, res, next) {
7877 ! ( chck && chck . userId ) ) {
7978 let err = new Error ( 'All fields required.' ) ;
8079 err . status = 400 ;
81- console . log ( ' err...' + err ) ;
80+ console . log ( err . message ) ;
8281 return res . redirect ( '/datajunk' ) ;
8382 } else {
8483 User . findById ( chck . userId ) . exec ( ( error , user ) => {
@@ -88,23 +87,20 @@ router.post('/newscrapper', function (req, res, next) {
8887 apisid [ 'scrapperid' ] = scrapper . _id ;
8988 User . findOneAndUpdate ( { _id : chck . userId } , apisid ,
9089 ( error , success ) => {
91- if ( error ) {
92- res . redirect ( '/datajunk' ) ;
93- }
9490 return res . redirect ( '/datajunk' ) ;
9591 } ) ;
9692 } ) ;
9793 }
9894 } ) ;
9995 }
10096} ) ;
97+
10198/**
10299 * @param {string } path
103100 * @param {function } callback
104101 * @memberof Routes.page.datajunk
105102 */
106103router . post ( '/scrapper/newsource' , function ( req , res , next ) {
107- param . logco ( 'post scrapper newsource' , req . session . userId ) ;
108104 if ( ! req . body . name || ! req . body . name . length ||
109105 ! req . body . sourcegenre || ! req . body . sourcetype ||
110106 ! req . body . sourcename || ! req . body . sourcereqpath ||
@@ -114,6 +110,7 @@ router.post('/scrapper/newsource', function (req, res, next) {
114110 console . log ( err ) ;
115111 return res . redirect ( '/datajunk' ) ;
116112 } else {
113+ param . logco ( 'post scrapper newsource' , req . session . userId ) ;
117114 User . findById ( req . session . userId ) . exec ( ( error , user ) => {
118115 if ( user ) {
119116 let newsource = {
0 commit comments