File tree 3 files changed +43
-33
lines changed 3 files changed +43
-33
lines changed Original file line number Diff line number Diff line change @@ -2,22 +2,3 @@ import axios from "axios";
2
2
import config from "./config/config" ;
3
3
import queries from "./queries/queries" ;
4
4
5
-
6
- const testPostReq = async ( ) => {
7
- const data = await axios ( {
8
- url : "http://localhost:8000/api/get" ,
9
- method : "POST" ,
10
- data : {
11
- LEETCODE_SESSION : config . LEETCODE_SESSION ,
12
- CSRFTOKEN : config . CSRFTOKEN ,
13
- queryData : queries . getDailyChallengeQuery ,
14
- } ,
15
- } ) ;
16
- return data . data . data ;
17
- } ;
18
-
19
- console . log (
20
- testPostReq ( ) . then ( ( res ) =>
21
- console . log ( res . data . data . activeDailyCodingChallengeQuestion . question )
22
- )
23
- ) ;
Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " leetcode" ,
3
- "type" : " module" ,
4
- "version" : " 1.0.0" ,
5
- "description" : " " ,
6
- "main" : " index.js" ,
7
- "scripts" : {
8
- "test" : " echo \" Error: no test specified\" && exit 1"
9
- },
10
- "keywords" : [],
11
- "author" : " " ,
12
- "license" : " ISC" ,
13
- "dependencies" : {
14
- "axios" : " ^1.1.3"
15
- }
2
+ "name" : " leetcode" ,
3
+ "type" : " module" ,
4
+ "version" : " 1.0.0" ,
5
+ "description" : " " ,
6
+ "main" : " index.js" ,
7
+ "scripts" : {
8
+ "test" : " node --experimental-specifier-resolution=node tests/test.js" ,
9
+ "start" : " node --experimental-specifier-resolution=node index.js"
10
+ },
11
+ "keywords" : [],
12
+ "author" : " " ,
13
+ "license" : " ISC" ,
14
+ "dependencies" : {
15
+ "axios" : " ^1.1.3"
16
+ }
16
17
}
Original file line number Diff line number Diff line change
1
+ import axios from "axios" ;
2
+
3
+ import config from "../config/config" ;
4
+ import queries from "../queries/queries" ;
5
+
6
+ const testPostReq = async ( ) => {
7
+ const data = await axios ( {
8
+ url : "http://localhost:8000/api/v1/query" ,
9
+ method : "POST" ,
10
+ data : {
11
+ LEETCODE_SESSION : config . env . LEETCODE_SESSION ,
12
+ CSRFTOKEN : config . env . CSRFTOKEN ,
13
+ queryData : queries . getDailyChallengeQuery ,
14
+ } ,
15
+ } ) ;
16
+ return data . data . data ;
17
+ } ;
18
+
19
+ const test = ( ) => {
20
+ console . log (
21
+ testPostReq ( ) . then ( ( res ) =>
22
+ // console.log(res.data.data.activeDailyCodingChallengeQuestion.question)
23
+ console . log ( res . data )
24
+ )
25
+ ) ;
26
+ } ;
27
+
28
+ test ( )
You can’t perform that action at this time.
0 commit comments