on master help sign in
Rename also function name transformer for Axios
2c0fe98Freezeboy
servant-js/examples/www/axios/index.html+3−3
@@ -17,11 +17,11 @@
17<script type="text/javascript">
17<script type="text/javascript">
18window.addEventListener('load', function() {
18window.addEventListener('load', function() {
19 // we get the current value stored by the server when the page is loaded
19 // we get the current value stored by the server when the page is loaded
20− getcounter().then(updateCounter).catch(alert);
20+ getCounter().then(updateCounter).catch(alert);
21
21
22 // we update the value every 1sec, in the same way
22 // we update the value every 1sec, in the same way
23 window.setInterval(function() {
23 window.setInterval(function() {
24− getcounter().then(updateCounter).catch(alert);
24+ getCounter().then(updateCounter).catch(alert);
25 }, 1000);
25 }, 1000);
26});
26});
27
27
@@ -33,7 +33,7 @@ function updateCounter(response)
33// when the button is clicked, ask the server to increase
33// when the button is clicked, ask the server to increase
34// the value by one
34// the value by one
35document.getElementById('inc').addEventListener('click', function() {
35document.getElementById('inc').addEventListener('click', function() {
36− postcounter().then(updateCounter).catch(alert);
36+ postCounter().then(updateCounter).catch(alert);
37});
37});
38</script>
38</script>
39</body>
39</body>
servant-js/src/Servant/JS/Axios.hs+1−1
@@ -112,7 +112,7 @@ generateAxiosJSWith aopts opts req = "\n" <>
112 where
112 where
113 hasNoModule = null (moduleName opts)
113 hasNoModule = null (moduleName opts)
114
114
115− fname = namespace <> (functionRenamer opts $ req ^. funcName)
115+ fname = namespace <> (functionNameBuilder opts $ req ^. funcName)
116
116
117 method = map toLower $ req ^. reqMethod
117 method = map toLower $ req ^. reqMethod
118 url = if url' == "'" then "'/'" else url'
118 url = if url' == "'" then "'/'" else url'