-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapiRequestType.js
36 lines (33 loc) · 941 Bytes
/
apiRequestType.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// to create a account using /api/account
const data = {
'account_name': 'LRBZ',
'account_email': '[email protected]',
'seller_name': 'Chand Ahmed',
'store_name': 'Leather Bazar',
'contact_number': '9321293727',
'status': 'Active'
}
const url = 'http://127.0.0.1:8000/api/account'
const res = await(await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
})).json()
// update last scrap time
const url = 'http://127.0.0.1:8000/api/account/LRBZ'
const data = {
'last_scrap': Date.now(),
'isFirstScrap': false
}
const res = await(await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
})).json()
// get account details or get last scrap time
const url = 'http://127.0.0.1:8000/api/account/LRBZ'
const res = await(await fetch(url)).json()