It is a HTTP request plugin with synchronize way.
<script src="/path/to/HttpRequest.js"></script>
const http = new HttpRequest({
'baseUrl': 'http://localhost:8000/api/v1/',
'responseDataType': 'JSON'
});
const listApiCall = http.call('get-list-data', 'GET');
listApiCall.then((responseData)=>{
... do something ...
});
http.setHeader('x-access-token', '<token data>');
http.setHeader('Content-Type', '<content type>');
.... more on ...
http.call('authentication', 'POST', null, JSON.stringify({
"email":"test@test.com",
"password":"test@123"
})).then((responseData)=>{
... do something ...
});