File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ class Auth {
1313 this . password = config . password ;
1414 this . grant_type = config . grant_type ;
1515 this . client_id = config . client_id ;
16- this . log = config . log ;
1716 this . response_type = config . response_type ;
1817 this . request_timeout = config . request_timeout ;
1918 }
@@ -37,7 +36,20 @@ class Auth {
3736 )
3837 } ;
3938
40- const { data } = await axios ( config ) ;
39+ const { data } = await axios ( config )
40+ . then ( ( res ) => {
41+ // Send log message when endpoint request is successful
42+ console . warn ( `[${ config . method . toUpperCase ( ) } ] ${ config . url } (${ res . statusText } )` ) ;
43+
44+ return res ;
45+ } )
46+ . catch ( ( err ) => {
47+ // Send log message when endpoint request is unsuccessful
48+ console . error ( `[${ config . method . toUpperCase ( ) } ] ${ config . url } - ${ err . message } ` ) ;
49+
50+ return err ;
51+ } ) ;
52+
4153 return data ;
4254 }
4355}
You can’t perform that action at this time.
0 commit comments