File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ class UserCommand extends Command {
7474 ) ;
7575
7676 const options = {
77- hostname : "localhost:1337" ,
77+ hostname : "http:// localhost:1337" ,
7878 path : "/api" ,
7979 method : "POST" ,
8080 headers : {
@@ -96,6 +96,7 @@ class UserCommand extends Command {
9696 res . on ( "end" , ( ) => {
9797 console . log ( "Response: " , JSON . parse ( data ) ) ;
9898 const Data = JSON . parse ( data ) ;
99+ console . log ( Data ) ;
99100 } ) ;
100101 } )
101102 . on ( "error" , ( err ) => {
Original file line number Diff line number Diff line change 1+ const https = require ( "https" ) ;
2+ const { olivetinUserName, olivetinPass } = require ( "../config.json" ) ;
3+
4+ const options = {
5+ hostname : "http://localhost:1337" ,
6+ path : "/api" ,
7+ method : "POST" ,
8+ headers : {
9+ "Content-Type" : "application/json" ,
10+ Accept : "application/json" ,
11+ } ,
12+ } ;
13+
14+ const data = JSON . stringify ( {
15+ username : `${ olivetinUserName } ` ,
16+ password : `${ olivetinPass } ` ,
17+ } ) ;
18+
19+ export function login ( ) {
20+ const req = https
21+ . request ( options , ( res ) => {
22+ let data = "" ;
23+ res . on ( "data" , ( chunk ) => {
24+ data += chunk ;
25+ } ) ;
26+ res . on ( "end" , ( ) => {
27+ console . log ( JSON . parse ( data ) ) ;
28+ } ) ;
29+ } )
30+ . on ( "error" , ( err ) => {
31+ console . log ( "Error: " , err . message ) ;
32+ } ) ;
33+ }
34+
35+ module . exports = {
36+ login,
37+ } ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments