disable cors for dev demopage

This commit is contained in:
Roman Hotsiy 2016-12-28 15:11:43 +02:00
parent 86c0dcbfe1
commit 892d4f0082
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
2 changed files with 5 additions and 1 deletions

View File

@ -24,6 +24,9 @@
<redoc scroll-y-offset="body > nav" spec-url='swagger.yaml' lazy-rendering></redoc> <redoc scroll-y-offset="body > nav" spec-url='swagger.yaml' lazy-rendering></redoc>
<script>
window.__REDOC_DEV__ = true;
</script>
<script src="main.js"> </script> <script src="main.js"> </script>
<script src="/webpack-dev-server.js"></script> <script src="/webpack-dev-server.js"></script>
<script src="/polyfills.js"></script> <script src="/polyfills.js"></script>

View File

@ -7,7 +7,8 @@
var url = window.location.search.match(/url=([^&]+)/); var url = window.location.search.match(/url=([^&]+)/);
if (url && url.length > 1) { if (url && url.length > 1) {
url = decodeURIComponent(url[1]); url = decodeURIComponent(url[1]);
document.getElementsByTagName('redoc')[0].setAttribute('spec-url', '\\\\cors.apis.guru/' + url); url = window.__REDOC_DEV__ ? url : '\\\\cors.apis.guru/' + url;
document.getElementsByTagName('redoc')[0].setAttribute('spec-url', url);
} }
function updateQueryStringParameter(uri, key, value) { function updateQueryStringParameter(uri, key, value) {