File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,10 +41,7 @@ module.exports = function server(options = {}) {
4141 } ) ;
4242
4343 function checkConfiguration ( { agent } , res , next ) {
44- if ( ! agent . isEnabled ( ) ) {
45- console . error ( { status : "ignored" } ) ;
46- res . status ( 403 ) . json ( { status : "ignored" } ) ;
47- } else if ( ! agent . isConfigured ( ) ) {
44+ if ( ! agent . isConfigured ( ) ) {
4845 console . error ( { status : "not configured" } ) ;
4946 res . status ( 403 ) . json ( { status : "not configured" } ) ;
5047 } else {
@@ -81,8 +78,13 @@ module.exports = function server(options = {}) {
8178 } ) ;
8279
8380 app . post ( "/sync" , checkConfiguration , ( { agent } , res ) => {
84- agent . async ( "startSync" ) ;
85- res . json ( { status : "scheduled" } ) ;
81+ const response = { status : "ignored" } ;
82+ if ( agent . isEnabled ( ) ) {
83+ response . status = "scheduled" ;
84+ agent . async ( "startSync" ) ;
85+ }
86+
87+ res . json ( response ) ;
8688 } ) ;
8789
8890 // Error Handler
You can’t perform that action at this time.
0 commit comments