Use /test URL prefix from CLJS when on testnet

* because we are not using a virtual host for the testnet instance,
  the client AJAX requests must prefix http path with '/test'
This commit is contained in:
Teemu Patja 2017-06-01 14:37:05 +03:00
parent 57f136bdb3
commit 3bb8219f49
No known key found for this signature in database
GPG Key ID: F5B7035E6580FD4C
3 changed files with 7 additions and 3 deletions

View File

@ -39,7 +39,7 @@
{% style "https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.8/semantic.min.css" %}
<link href="/css/style.css?v={{commiteth-version}}" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/js/app.js?v={{commiteth-version}}"></script>
<script type="text/javascript" src="{{root-path}}/js/app.js?v={{commiteth-version}}"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

View File

@ -21,7 +21,8 @@
:authorize-url (github/signup-authorize-url)
:authorize-url-admin (github/admin-authorize-url)
:commiteth-version version
:on-testnet? (env :on-testnet)}))
:on-testnet? (env :on-testnet)
:root-path (if (env :on-testnet) "/test" "")}))
(defroutes home-routes
(GET "/" {{user :identity} :session}

View File

@ -17,7 +17,10 @@
(reg-fx
:http
(fn [{:keys [method url on-success on-error finally params]}]
(fn [{:keys [method url_ on-success on-error finally params]}]
(let [url (if (config/on-testnet?)
(str "/test" url_)
url_)])
(method url
{:headers {"Accept" "application/transit+json"}
:handler on-success