Commit 80151ffaeb6dc1b07d426950a2c1a9b4406bb3cb
1 parent
e4f8f68e
Exists in
master
and in
11 other branches
Pass fields parameter to api
Showing
1 changed file
with
5 additions
and
2 deletions
Show diff stats
js/main.js
... | ... | @@ -94,7 +94,7 @@ $.getJSON(noosferoAPI) |
94 | 94 | }); |
95 | 95 | |
96 | 96 | function loadRandomProposal(topic_id, private_token) { |
97 | - var url = host + '/api/v1/articles/' + topic_id + '/children' + '?private_token=' + private_token + '&limit=1&order=random()&_='+new Date().getTime(); | |
97 | + var url = host + '/api/v1/articles/' + topic_id + '/children' + '?private_token=' + private_token + '&limit=1&order=random()&_='+new Date().getTime()+'&fields=id,name,author'; | |
98 | 98 | $.getJSON(url).done(function( data ) { |
99 | 99 | var article = data.articles.length > 0 ? data.articles[0] : null; |
100 | 100 | $('.support-proposal-container').html(supportProposalTemplate(article)); |
... | ... | @@ -103,7 +103,10 @@ function loadRandomProposal(topic_id, private_token) { |
103 | 103 | $.ajax({ |
104 | 104 | type: 'post', |
105 | 105 | url: host + '/api/v1/articles/' + article.id + '/vote', |
106 | - data: {value: $(this).data('vote-value'), private_token: private_token} | |
106 | + data: { | |
107 | + value: $(this).data('vote-value'), | |
108 | + private_token: private_token | |
109 | + } | |
107 | 110 | }).done(function( data ) { |
108 | 111 | loadRandomProposal(topic_id, private_token); |
109 | 112 | }); | ... | ... |