Skip to content

Commit

Permalink
Fix getAllRequests
Browse files Browse the repository at this point in the history
  • Loading branch information
Zlobin committed May 11, 2016
1 parent c538290 commit 02f9de2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 2 additions & 3 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,8 @@ <h3 class="panel-title">Response</h3>
});

all.addEventListener('click', function(event) {
var allRequests = ajax().getAllRequests();

output.innerHTML = JSON.stringify(allRequests);
output.innerHTML = JSON.stringify(ajax().getAllRequests(),
undefined, 2);
});

method.addEventListener('change', function(event) {
Expand Down
7 changes: 5 additions & 2 deletions src/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,14 @@ export function ajax(url, parameters = {}) {
}

function getAllRequests() {
const response = {};
const response = [];

_requests.forEach(value => {
if (!is._undefined(value)) {
response[value] = _meta.get(value);
response.push(Object.assign({},
_meta.get(value), {
id: value.toString()
}));
}
});

Expand Down

0 comments on commit 02f9de2

Please sign in to comment.