Commit 7a3d3dbd2a6066e1c92aa8f5aac1aca6cd05b5d7
1 parent
4b503934
Exists in
master
and in
10 other branches
Add a better environment flag.
Showing
1 changed file
with
5 additions
and
6 deletions
Show diff stats
js/main.js
... | ... | @@ -30,13 +30,12 @@ if(participa){ |
30 | 30 | //var proposal_discussion = '401'; //casa |
31 | 31 | } |
32 | 32 | |
33 | -// Set isProduction to true when at production environment | |
34 | -// Set isProduction to false when at development environment | |
35 | -var isProduction = true; // default is true | |
36 | -if( isProduction ){ | |
37 | - var noosferoAPI = host + '/api/v1/articles/' + proposal_discussion + '?private_token=' + private_token + '&fields=id,children,categories,abstract,body,title,image,url'; | |
38 | -} else { | |
33 | +// Load data from localhost when it is dev env. | |
34 | +var isLocalhost = (window.location.hostname === 'localhost' || window.location.hostname === '0.0.0.0'); | |
35 | +if( isLocalhost ){ | |
39 | 36 | var noosferoAPI = '/data.json'; |
37 | +} else { | |
38 | + var noosferoAPI = host + '/api/v1/articles/' + proposal_discussion + '?private_token=' + private_token + '&fields=id,children,categories,abstract,body,title,image,url'; | |
40 | 39 | } |
41 | 40 | |
42 | 41 | $.getJSON(noosferoAPI) | ... | ... |